Closed eldond closed 3 years ago
Maybe https://matplotlib.org/cycler/ would be helpful here?
@smithsp it doesn't seem easy to use cycler this time. I want definite colors for each value of a counter, and I may use two loops over the same thing in places.
Merging #133 into master will decrease coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #133 +/- ##
==========================================
- Coverage 79.80% 79.80% -0.01%
==========================================
Files 50 50
Lines 9562 9561 -1
==========================================
- Hits 7631 7630 -1
Misses 1931 1931
Impacted Files | Coverage Δ | |
---|---|---|
omas/omas_plot.py | 78.76% <100.00%> (-0.02%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 98f9528...25bc839. Read the comment docs.
@eldond Maybe the matplotlib cycler was too much. I investigated further and it uses itertools.cycle
underneath, which could be used as:
for i,(l,c) in enumerate(zip(labels,itertools.cycle(colors))):
or
colors = [c for c in zip(labels, itertools.cycle(color))]
...
colors[i]
@smithsp I don't know how to test for how the plots look in terms of using consistent or reasonable colors, so the unit tests won't catch a problem with the wrong coloration due to a mishap with a cycler. So, that increases the time and effort required for redevelopment and testing and I can't do it right now. You're welcome to take over or open an issue if you think it's important. I agree that using a cycler from the start would've been nicer than these lists, and I'll try to remember to do that next time.
@eldond I'm not going to take over. I just wanted to make sure that you were aware when you have the bandwidth.