SasView/sasview

Weird plot auto scaling

Closed this issue · 1 comments

Describe the bug
Not sure when this happened but during PR testing today (always from installers) I discovered that the auto scaling of plots behavior has changed in very strange ways.

Using my favorite apoferritin data set:

  • Sending to fitting and plotting the window scales to have the theory curve fit from the top left to bottom right... exactly. This becomes obvious if you make scale tiny so that the theory curve is entirely well below the data (e.g a scale of 1e-6). Hitting home on the graph will however reset so that both data and theory are all contained in the window
  • Sending the data to a plot and scaling to Kratky then bring up a linear fit and shrink the range for fitting then fit. The plot now blows up to again show the fit line not the data (in my case the bottom left to the top right of the liner fit line. So the data out of the fit range is not visible. Exiting the modal fit panel and clicking on the graph home in this case does nothing to the graph. The only way to get the whole contents of the window back into the viewport is to manually change the x and y axis ranges.
  • Sending the data to a plot and scaling to Porod then bring up a linear fit shrink the range for fitting then fit. The plot now blows up to again show the fit line not the data. So the data out of the fit range is not visible. Exiting the modal fit panel and clicking on the graph home in this case does nothing to the graph itself (as before) but makes the window get smaller and smaller every time you hit home/reset
  • Sending the data to a plot and scaling to Guinier then bring up a linear fit. Immediately the data is shoved into the left hand side as the default x axis range is for the values in Q though the data are now in Q^2. Shrink the range for fitting then fit. No zoom takes place and other than the fact that the default zoom was wrong it behaves normally. If you zoom in prior to opening the linear fit panel, the data will stay zoomed till actually doing the fit then the window will revert to as above (with all the data on the left hand side of the plot) and continue "normally." Exit the modal window and click the home/reset button. Now the graph zooms to have the fit line go from the top left corner to the bottom right corner (so "weird" but in the opposite order from the fitpage "weird"). And why the different linear fits all behave very differently in their auto-zooming is another mystery.

To Reproduce
Steps to reproduce the behavior:
See above

Expected behavior
clicking fit in any case should never also perform a zoom. And to the extent a zoom has happened hitting home/reset should recover the window

SasView version (please complete the following information):

  • Version: 6.0.0b2 Several PR installers from 8/21/2024

Operating system (please complete the following information):

  • OS: Windows 10

See #2967. The chart range is now set based on the input data, not using matplotlib defaults because mpl was oddly scaling some, mostly flat, data sets. The relates to your first bullet.

The other bullet points (rescaling after linear fits, krtky, etc.) are all, I believe, directly related to #3020.