| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| zoom_axes = ["2d", "color zoom in", "color zoom out"] | ||
| pan_axes = ["2d", "color pan up", "color pan down"] | ||
|
|
||
| fig, ax_dict = plt.subplot_mosaic( | ||
| [ | ||
| zoom_axes, | ||
| pan_axes | ||
| ], | ||
| constrained_layout=True, | ||
| ) |
There was a problem hiding this comment.
I find the multitude of axes rather confusing. AFAICS they only differ in their initial clim values. I assume that's intended to give a good starting point for the respective interactions. However, all operation work reasonably well when starting on the "2d" image. It think it's better to have only the one image and let the user try all operations on that image.
I also found that panning on the image was really slow, likely because varying tick labels cause the constrained_layout solver to kick in again. One would have to deactivate constrained_layout after the first draw. But that's also obsolete if we can get away with one image.
Sorry, something went wrong.
There was a problem hiding this comment.
👍 The reason for that was to demonstrate what the outcome of zooming/panning would do in each of the cases, but perhaps you're right it would be better to just let someone start interacting with the image and see for themselves. I updated this to have 3 images now with data ranges that are under/normal/over to try and get the sense that you can interact with the colorbar to identify new data regions.
Let me know what you think of this approach... Happy to go to just 1 image as well if you think that would be more clear.
Sorry, something went wrong.
There was a problem hiding this comment.
I think this would be enough:
fig, ax = plt.subplots()
im = ax.imshow(data2d)
fig.colorbar(im, ax=ax)
ax.set_title('Pan on the colorbar to shift the mapping data -> color\nZoom on the colorbar to scale the mapping data -> color ')
plt.show()
Since the gallery is static by nature, we simply cannot show interactivity. IMHO the best we can do is to have a simple example and tell the readers what they should try themselves.
If you really want to do more, I suggest to show some example images additionally:
Sorry, something went wrong.
|
OK, I went with your suggestion to keep it simple. I changed "mapping data -> color" to "norm" as that seems easier to read. I agree that it is tough to demonstrate interactivity, and I'm not sure how many people even know all of the options for interactivity! I know I personally keep learning new things just by stumbling upon them. Perhaps a solution could be to add a tutorial page with some screen recorded gifs of people using the interactive features... |
Sorry, something went wrong.
While technically correct, "norm" requires at least mid-level knowledge of Matplotlib. Users only using imshow(..., vmin= ..., vmax=...) likely won't know what a "norm" is. Can we find a phrase that's also understandable for inexperienced users? Maybe "... to shift the color mapping"? (somewhat imprecise, but I think ti would get the idea across).
That'd be a really cool thing 😀 |
Sorry, something went wrong.
The colormaps have interactivity with zoom/pan now, so demonstrate what those modes do with the new example. This is instead of using callbacks and mouse events for updates.
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
$ git checkout v3.5.x $ git pull
$ git cherry-pick -m1 5431e3888db24e57a4856d14fca9eb2d065cfd53
$ git commit -am 'Backport PR #21236: DOC: Update interactive colormap example'
git push YOURFORK v3.5.x:auto-backport-of-pr-21236-on-v3.5.x
And apply the correct labels and milestones. Congratulation you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove Still Needs Manual Backport label once the PR gets merged. If these instruction are inaccurate, feel free to suggest an improvement. |
Sorry, something went wrong.
…on-v3.5.x Backport PR #21236: DOC: Update interactive colormap example
…xample DOC: Update interactive colormap example
DOC: Update interactive colormap example
| Back | FazBrowse Home | New Git URL |
PR Summary
The colormaps have interactivity with zoom/pan now, so demonstrate what those modes do with this new example. This is instead of using callbacks and mouse events for updates that were used in the previous example.
Example modified from: #19515 (comment)
xref: #19515 and #20471
PR Checklist