Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
f135672
tobb0a4eb
Compare
story645 left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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)
timhoffm commentedJul 13, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 :/
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
f199fd4
toa425afb
CompareThere 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 ofchoosing 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.
toexplicitlyensureconsistentdatacoloring.Themostimportantaspect | |
isthedatanormalization.Byexplicitlycreatinganormandusingthat | |
forallimages,weensurethatallimagesarescaledconsistently. | |
toexplicitlyensureconsistentdatacoloringbyusingthesamedatanormalization (datascaling)methodforalltheimages.Weensurethatsamemethodisusedbyexplicitlycreatinga*norm*objectthatwepasstoalltheimageplottingmethods. |
# 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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
timhoffm commentedJul 30, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
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
Uh oh!
There was an error while loading.Please reload this page.
# 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>
f7b3def
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
@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.xBackport 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-docBackport PR#28546 on branch v3.9.1-doc (DOC: Clarify/simplify example of multiple images with one colorbar)
Uh oh!
There was an error while loading.Please reload this page.
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.