xraylarch
xraylarch copied to clipboard
[xas_viewer] plot window -> keep custom zoom
@newville a feature request I get usually from the users is to have the possibility to keep the selected zoom in an plot window when replotting. This would be something like the following:
- plot something (in plot window: plot_N)
- with the mouse zoom a region in plot_N
- when replotting in plot_N (current group or selected) keep the XY region as selected before
- to reset the plot region either right click on the plot window or select one of the standard ranges given in the combo box
What do you think?
@maurov Yeah, that's a reasonable request, especially when plotting mu(E) / XANES data, deglitching, fitting, etc.
It might need some sanity checks (do the plot range and data range overlap, was the last plot with Energy as X axis, and so on), but I think it should be doable and would be a reasonable default behavior, at least for "Energy" plots.
@maurov I think this is partially done, especially for plotting in the "normalization" window. That is, a zoomed-in view should be preserved if the data extends over the same x (Energy) range, and if the plot labels for x and y are the same. The intention is for the zoom level to be kept when switching from "plot one group" and "plot many groups" too.
And, it also should work when deglitching data. It might be needed in more places but I think this it is a start.
@newville thanks for working on this. I edit again my comment (4th time, sorry!) because now does not work anymore and I do not know why (just changed the selection of some groups). Well, I think I have to test more carefully and give a feedback later on.
Just few comments that hold:
- needs upgrade to
wxmplot 0.9.52
- visually slow (the data are fist plotted in the previous range and then zoomed to the custom one)
- to reset the zoom back one has to right click on the plot window (the reset could be also triggered by selecting energy range in the combo box of the normalization window
@maurov Thanks! I will investigate this more too -- I was developing/testing only on a Mac laptop. But I have also noticed that "plot slowness" can vary a lot based on matplotlib version and OS (and maybe other things), which is always sort of a moving target.