Closed markbandstra closed 3 years ago
I'm in favour of this fix. No more magic hex values! Could we automate the colour selection instead of a fixed list of 8? An fstring like f"C{i}" could handle it if we correctly tell it to skip C1 and C3 and those colours every time they come around in the cycle.
@jvavrek Good point, why keep the list a fixed but longer length if we can make it infinite.
How about this? Probably could be simplified further, and there are certainly other ways to do this:
import matplotlib
colors = [matplotlib.colors.to_rgb(c) for c in ["C0", "C2", "C4", "C5", "C6", "C7", "C8", "C9"]]
plt.figure()
plt.gca().set_prop_cycle(color=colors)
@markbandstra nice, I didn't know about set_prop_cycle
. Something like that would be great.
Fitter.custom_plot
fails with aIndexError: list index out of range
if there are more than three components to the model. The culprit is this line:A possible fix would be to extend the list like this:
where I left out
"C1"
and"C3"
since they are similar to other colors used in the plot (the centroids and best fit, respectively).