☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Update the y_axis_type between log and linear interactively with a widget

Community Support
mada0304
mada0304

I was trying to update the y_axis_type by invoking the following line:

def update_plot(attr,old,new):

yscale=yscale_select.value

if yscale==‘log’:

fig.y_mapper_type=‘log’

elif yscale==‘linear’:

fig.y_mapper_type=‘linear’

source.update…

But it seems that the y_axis is not updated in the plot. Is there any way to update the y_axis now?

⌁   Link to post
birdsarah_continuum
birdsarah_continuum

I’m assuming u r using the server.

What u want to isn’t going to be as easy as u hope. When u use the axis_type argument, under the hood bokeh chooses whether to attach a linear or log axis to your plot.

To switch them out i believe you’re going to need to send a whole new plot.

So instead of having code that on callback changes a property of your figure, have it generate a whole new figure.

Then if you wrap your figure in a layout box like VBox, you can just change the ‘children’ in your server callback and the new plot will get pushed down by bokeh server.

Best,

Sarah Bird
sbird@continuum.io

···

On Mar 15, 2016, at 1:44 PM, mada0304 mqda0304@gmail.com wrote:

I was trying to update the y_axis_type by invoking the following line:

def update_plot(attr,old,new):

yscale=yscale_select.value

if yscale==‘log’:

fig.y_mapper_type=‘log’

elif yscale==‘linear’:

fig.y_mapper_type=‘linear’

source.update…

But it seems that the y_axis is not updated in the plot. Is there any way to update the y_axis now?

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/66dfb289-ad0b-40ca-a3d3-5ef504f2b7ca%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
dperrot
dperrot

Hi! I wasn’t sure-- has any functionality been added to update a figure’s y_axis_type in a callback? I’m trying to just update the figure property by resetting the y_axis_type, but I’m getting an error (AttributeError( "unexpected attribute ‘y_axis_type’ to Figure…)). Thanks in advance for your help!

⌁   Link to post
Bryan
Bryan

Updating the type in place is going to be difficult, if possible at all. Axes are some of the most complicated objects in all of Bokeh and they have connections and are wired up to many other things, making them very difficult to swap out. If you need to switch between linear and log axes my advice is to make two plots that are identical except for the axes (and maybe any labels or titles) and then make them visible/invisible as appropriate.

⌁   Link to post

End of archived discussion · Replies are disabled