How do I change colors in DOSPlotter?

Hi probably somewhat of a trivial question but how do I change the colors of the lines in DOSPlotter? I know its a matplotlib object and I understand how to add elements to it, but I can’t figure out how to change the colors of the individual lines. In particular when I do:
dosplot.add_dos(“Total DOS”, dos)
I would like it to be black but it seems to have some sort of order of colors it chooses where the 6th color is always yellow (which is quite unsightly).

The code I am using:
v = Vasprun(“FAPbCl3_Cubic_666_Gam/vasprun.xml”, parse_dos=True)
dos = dosrun.complete_dos
dosplot = DosPlotter(sigma=0.05)
dosplot.add_dos_dict(dos.get_element_dos())
dosplot.add_dos(“Total DOS”, dos)
pltDOS = dosplot.get_plot()
pltDOS.grid()

Lavrenty

I think to do this you would need to change the code for the DosPlotter object in pymatgen. Specifically line 140 in https://github.com/materialsproject/pymatgen/blob/5fb54181ddb90eb74f12bfe311be72b2b2fd0fd4/pymatgen/electronic_structure/plotter.py

140: colors = palettable.colorbrewer.qualitative.Set1_9.mpl_colors

If you would like to submit a pull request with the yellow replaced with another color, it would probably be well received.

1 Like