According to the documentation openmc.Universe — OpenMC Documentation, for parameter colors of method openmc.Universe.plot, red, green, blue, and alpha should all be floats in the range [0.0, 1.0]. But the following code results into a runtime error Bad RGB in plot:
It seems that rgb should be int in the range [0,255]. I don’t know whether it originates from a breaking change of matplotlib or openmc. Maybe we should update the docs?
Thanks for pointing this out @kingyue. We recently changed what happens under the hood when you call Universe.plot. Before it used to be generated/colored by matplotlib, but now it relies on the openmc executable to produce a png and then simply shows that png and the coloring options are slightly more restrictive as you’ve found. I’ll get the documentation updated. You are correct that alpha channel is not supported.
Piggybacking on to this discussion as it involves issues with RGB etc.
I’ve just been looking into the Python universe.plot plotting.
@Shimwell, them outlines are rad @gridley, auto-legend is nice and handy, but I can’t seem to get it working with RGB e.g.: (10, 255, 20), it complains that it’s not RGBA, then I make it RGBA and it doesn’t like that either. I can only get it working with color names e.g.:‘blue’
A consequence/constraint of the patches routine?