Hi,
After searching in various places, I still don’t really know if it’s possible to dynamically change a figure scale (in my case from linear to log). As a turnaround, I’m using a panel with two tabs but I would love to just have the possibility to switch between the two scales using a radio buttons group for example. Am I missing something obvious ? I tried to change the y_scale attribute but nothing is modified when it’s done.
Thank you
It is definitely possible - I’ve done it before with a separate toolbar button. Can’t get to the code right now, so will post it tomorrow.
You can do something like below:
def function_to_change_log():
if log_hist_cb.active:
if log_hist_cb.active[0] == 0:
log_hist = numpy.log(your_dataframe)
log_hist_cb = CheckboxGroup(
labels=["Log transform axis"], active=[])
The example is here: https://github.com/samirak93/ML_Tool/blob/ff24f178afc03ff8aeb1ba6d76f930353a8c17f8/main.py#L367
It doesn’t change the axis/scale, it changes the data. Often, that’s undesirable.
1 Like
Ah, sorry - my existing code just re-renders the whole plot with new parameters, one of which is y_axis_type
.
Just tried to do that without re-rendering the whole plot, and now I remember why it didn’t work.
The issue is that PlotView
stores all the scales internally when it’s initialized. You cannot overwrite them without creating a custom Plot
class.
Thanks for the answers. I will try that ASAP.
Hi, I’m pretty interested to try this, could you give me some guidelines of which files should I look?
Thanks in advance