Log y-axis toggle button

Can anyone help with the adding a button to the layout which can toggle log/linear scale on the y-axis?

I know how to set the Y-axis with a log scale from this reference document.

But after reading the docs on buttons, I was unable to gleen enough information to format a drop down or button which could toggle the y-axis scale. The other problem was my layout was in a for-loop because I’m doing multiple add_trace.

In the end I solve my issue using shiny. By adding an input on the type… & adding a dynamic UI render below the plot

  1. yaxis = list(title = “Price”, type=input$logscale)

  2. output$logControls <- renderUI({
    selectInput(“logscale”, “Scale Y-Axis”, choices = c(“log”,“linear”), selected = “log”, width = 100)

screenshot of the plotly chart incorporating the button

It would be nice to know how to achieve this within the plotly framework if possible.

1 Like