-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: Clarify/simplify example of multiple images with one colorbar #28546
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
Conversation
f135672
to
bb0a4eb
Compare
bb0a4eb
to
48ba413
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this should just be a stand alone example (dynamic cmap updating? ) with same colormap tag b/c it's a lot of information that applies in a specific use case. ETA: got cut off, but was talking about:
# %%
# The colors are now kept consistent across all images when changing the
# scaling, e.g. through zooming in the colorbar or via the "edit axis,
# curves and images parameters" GUI of the Qt backend.
#
# While the norm is shared, the colormaps are not. This is often ok
# because colormaps are usually not changed dynamically. However, a user
# could change the colormap of an individual image through the
# "edit axis, curves and images parameters" GUI of the Qt backend.
# Unlike with a norm, it does not help to share colormaps between images.
# Changes to the norm limits modify the norm object in place and thus
# propagate to all images. But changing a colormap sets a new colormap
# object to the images and thus does not propagate to the other images.
# To make all other images follow, you could additionally sync the
# colormaps using the following code::
#
# def sync_cmaps(changed_image):
# for im in images:
# if changed_image.get_cmap() != im.get_cmap():
# im.set_cmap(changed_image.get_cmap())
#
# for im in images:
# im.callbacks.connect('changed', sync_cmaps)
48ba413
to
63b48cc
Compare
I believe that this is the right place to discuss cmap syncing.
I've made a subsection "Advanced: Additionally sync the colormap" to better set the context for this. |
Ping @story645. What do you think of my suggestion? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So uh I now understand better why you want to leave that here and I'm OK w/ that, but I went back and read through the explanations and uh I think they may have accidentally ended up in enough detail to spur questions but not enough to answer em territory :/
f199fd4
to
a425afb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is definitely much much better than before, thank you so much! Comments mostly around the same implementation detail problem, which is how do we effectively communicate that norm instances can be shared but not cmap instances.
Am thinking maybe (and I understand if this is out of scope and should be a follow up PR) we write this once as the final section of choosing colormaps. Call it "Using colormaps across multiple plots" , have this explanation, and use it as the lead in to "why norms" since that's the next topic, and then just link to that section here.
to explicitly ensure consistent data coloring. The most important aspect | ||
is the data normalization. By explicitly creating a norm and using that | ||
for all images, we ensure that all images are scaled consistently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to explicitly ensure consistent data coloring. The most important aspect | |
is the data normalization. By explicitly creating a norm and using that | |
for all images, we ensure that all images are scaled consistently. | |
to explicitly ensure consistent data coloring by using the same data normalization (data scaling) method for all the images. We ensure that same method is used by explicitly creating a *norm* object that we pass to all the image plotting methods. |
# curves and images parameters" GUI of the Qt backend. This is sufficient | ||
# for most practical use cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# curves and images parameters" GUI of the Qt backend. This is sufficient | |
# for most practical use cases. | |
# curves and images parameters" GUI of the Qt backend. |
Folks will tell us if it's sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this as guidance and affirmation that most users can stop here. They don't have to inverst the following extra effort for cmap handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe "this is" is just ambiguous pronoun reference then.
a425afb
to
fd653d8
Compare
I've rewritten the paragraph on cmap sharing again. Focussing on the main point: Scaling changes the norm in place, but change of colormap changes the referenced colormap. Therefore sharing a colormap does not help and you need a different syncing mechanism. |
fd653d8
to
76e6c58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight wording nits but this is really clear now, thanks! Take/leave nits and can self merge
# curves and images parameters" GUI of the Qt backend. This is sufficient | ||
# for most practical use cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe "this is" is just ambiguous pronoun reference then.
Co-authored-by: hannah <story645@gmail.com>
@meeseeksdev backport to v.3.9.x |
I'm backporting so that this version gets into released docs. It may be that this will be changed agian for 3.10 because of the upocoming |
Something went wrong ... Please have a look at my logs. It seems that the branch you are trying to backport to does not exist. |
@meeseeksdev backport to v3.9.x |
…le images with one colorbar
…546-on-v3.9.x Backport PR #28546 on branch v3.9.x (DOC: Clarify/simplify example of multiple images with one colorbar)
@meeseeksdev backport to v3.9.1-doc |
…le images with one colorbar
…546-on-v3.9.1-doc Backport PR #28546 on branch v3.9.1-doc (DOC: Clarify/simplify example of multiple images with one colorbar)
I've simplified the basic example to only share the norm. This should be sufficient for most users and greatly simplifies the code. Syncing the colorbar moved to a separate comment - for those wo need the extra functionality.