question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fixing colors to samples in plot1d

See original GitHub issue

Is your feature request related to a problem? Please describe. By default, it seems the color order of stacked+overlayed processes in plot1d is fixed by yield. This makes side-by-side yield comparison of histograms difficult, particularly when one tries to compare individual process yield in a histogram (since if the yield order changes, the color also changes, instead of the color being fixed to a particular sample, so you can’t easily compare side-by-side).

Describe the solution you’d like I would like to have functionality for plot1d to create plots where both:

  1. processes are overlayed and stacked are ordered by yield (exists)
  2. specific colors are fixed to specific samples (to my knowledge does not exist)

Perhaps this could be passed as an option in plot1d.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
andrzejnovakcommented, Jun 22, 2021

hist should be solving this once https://github.com/scikit-hep/hist/pull/243 gets done

0reactions
lgraycommented, Dec 28, 2020

Concerning hist - we do, and I think what you pose as a solution is the right way to go. It’ll be a post 0.7.0 development unless you make a good reason on #396. It may mark 0.8.0 since I imagine there will be breaking changes at some level, or backwards compatibility will be a pain.

Thinking about it, making the plotting interface in coffea as thin as possible, approaching what you’re suggesting, would be a good extension of the 0.7.0 targets.

More generally, I wasn’t proposing an interface but rather a place where people can put recipes for specific useful behaviors so there’s not a parallel ecosystem of twikis and gists. By accumulating those it can help inform further development in dependent packages, and we can update/deprecate contrib items accordingly.

I think a contrib area thing makes a lot of sense from that perspective as typically these recipes involve assumptions about inputs or available packages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

getdist.plots — GetDist 1.4 documentation
GetDistPlotter. Main class for making plots from one or more sets of samples. GetDistPlotSettings. Settings class (colors, sizes, font, styles etc.) ...
Read more >
Fixing color in scatter plots in matplotlib - Stack Overflow
Setting vmin and vmax should do this. Here's an example: import matplotlib.pyplot as plt xyc = range(20) plt.subplot(121) ...
Read more >
Fixing color in scatter plots in Matplotlib - Tutorialspoint
Plot the lists, xs and ys, using scatter() method, with the list of colors. To display the figure, use show() method. Example. import...
Read more >
plot1d — coffea 0.7.20 documentation - GitHub Pages
plot1d . coffea.hist.plot1d(hist, ax=None, clear=True, overlay=None, stack=False, overflow='none', line_opts=None, fill_opts=None, error_opts=None, ...
Read more >
R Assign Fixed Colors to Categorical Variable in ggplot2 Plot ...
Assign Fixed Colors to Categorical Variable in ggplot2 Plot in R (Example). This page shows how to assign pre-defined colors to qualitative variables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found