-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
add colormodel parameter into px.imshow and test #2932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks a lot for the PR @liudj2008 ! The CI failures probably don't have anything to do with your PR: on py2.7, it looks like a new version of qtconsole forgot to say they were not compatible with python 2.7, but they seem to have fixed this so I restarted the build 🤞 (@nicolaskruchten this might affect some other PRs). Still investigating the doc problem. |
One difference between RGB and HSL is that the bounds for the channels are different:
Therefore I think we should disable Here is an example (using the
|
For the |
I'm not sure why this would mean we can't use binary_string? We can use HSL input to create a PNG, no? |
@nicolaskruchten we could indeed take the HSL input and convert it back to rgb to make a png, but then we're not making use of the HSL capability of the Image trace which was the original idea. With an H channel between 0 and 260 it's not possible to encode it on one byte. In fact I have no idea whether there is a native format for HSL images... |
Not sure I fully agree here... to me the original idea is to allow users to provide input data in HSL format, and ideally we would display that in the fastest way possible, no, regardless of the details of the underlying JS implementation? Maybe Plotly.js still needs to be told "hey this is meant to be HSL" so it can do the hover in HSL mode (essentially picking up the RGB value of the PNG pixel and reversing the HSL-to-RGB conversion) ? |
I agree with @nicolaskruchten , users do not have to worry about implementation, as long as we can "recognize" hsl from rga and show it properly. I do notice in graph_objs/_image.py, when initiating Image class, all we need to do is to pass in z and colormodel, and zmin and zmax will be defaulted depending on colormodel input (so we do not have to worry about the outrange issue). As @emmanuelle pointed out, the definition of binary_string in px module is to "force" image conversion to rgb/rgba so that to construct the img source to pass in go.Image, and we need to disable it for hsl/hsla images. So in that case, I will call future px on hsl image like this (no zmax, since it will be defaulted): |
merge updated master to branch
@emmanuelle So I merged the updated master with the branch, but still had the build-doc issue. Seems like it is related with notebook to html conversion. Is there anything I can do to fix it? I will add the modification to |
plotly.graph_objects
, my modifications concern thecodegen
files and not generated files.modified existing tests.
new tutorial notebook (please see the doc checklist as well).