KeckObservatory / Keck-ETC

Exposure time calculator for Keck instruments, with web-based API and GUI.
https://www2.keck.hawaii.edu/inst/etc/
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Toggle logarithmic y-axis scale on plots #3

Open Keaton-Blair opened 2 years ago

Keaton-Blair commented 2 years ago

For the Bokeh plots, it would be very helpful to be able to toggle between a log scale and linear scale on the y-axis. At the very least, changing the first plot (SNR vs. wavelength) to a log scale by default when trying to calculate exposure time (log(exp) vs. wavelength) would make it much easier to fit the entire data range within the plot, and much easier to view.

Keaton-Blair commented 2 years ago

Unfortunately, Bokeh's JavaScript API has no way to change the axis scale on a plot once it has already been created. So, the only way to toggle between scales currently would be to switch between entirely separate plots.

This could be accomplished in one of two ways:

However, due to Bokeh's internal organization, both of these approaches are currently unfeasible. Because the plots are grouped together in a GridPlot object, which improves the layout, organization, and responsiveness of the three plots, both of these approaches would require modifying the GridPlot by either toggling the visibility of plots or adding and removing plots. I've implemented both of these approaches, but they both generate a number of bugs that are much worse than the log scale problem we want to solve.

Bokeh's development is ongoing, and it's worth returning to the documentation (docs.bokeh.org/en/latest/docs/user_guide/bokehjs.html) in the future to see if these issues have been resolved. Note that the Bokeh source files in the ETC are stored in src/imports, and would need to be manually updated if a future version of Bokeh is implemented.