dr-rodriguez / SEDkitSIMPLE

Utilities and examples for using SEDkit with SIMPLE
0 stars 0 forks source link

Plot method options? #9

Open kelle opened 1 year ago

kelle commented 1 year ago

Sometimes, s.plot doesn't give the desired y range. Is there a way to set the y Max using sedkits plot method. We tried y_range but did not get the desired outcome. (Use case CFBDS J003402-005206)

dr-rodriguez commented 1 year ago

This sounds like an sedkit issue for @hover2pi

hover2pi commented 1 year ago

Yeah, I don't have it pass any kwargs to the figure yet unfortunately. This is super simple though and I'll make it so that the user can talk directly to the bokeh plot. I made this an issue in sedkit.

hover2pi commented 1 year ago

Oh, as a workaround though, I think you can create a bokeh figure first, set the x_range, and then pass the figure to the fig argument in the sed.plot method. I haven't tried this but I think it might work. E.g.

from bokeh.plotting import figure
from sedkit import SED
s = SED()
... SED stuff here...
my_fig = figure(x_range=(0.5, 2.5))
s.plot(fig=my_fig)
hover2pi commented 1 year ago

Oh! Wait, the plot is stored as s.fig when you run s.plot so you can just make your plot as usual then modify the range afterward with, e.g.

s.plot()
from bokeh.models import Range1d
from bokeh.plotting import show
s.fig.y_range = Range1d(0, 15)
show(s.fig)
kelle commented 1 year ago

I thought there was gonna be an "easy" workaround. Could the access to the fig object be added to the sedkit plot documentation? If you point me to it, I can also open a PR with this change.

Kelle