From this example here : Set linear or log axes from button or dropdown menu I can use a button to change the yaxis from linear to log. However i need to change it to sqrt.
I have looked at from Plotly: reference layout axis I have found that there is no type ("sqrt")
type Code: fig.update_yaxes(type=) Type: enumerated , one of ( "-" | "linear" | "log" | "date" | "category" | "multicategory" ) Default: "-" Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question.
Here is the exmaple code:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
y=[8, 7, 6, 5, 4, 3, 2, 1, 0]
))
fig.add_trace(go.Scatter(
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
y=[0, 1, 2, 3, 4, 5, 6, 7, 8]
))
fig.update_layout(title_text="CIR plot ",
updatemenus=[
dict(
buttons=list([
dict(label="Linear", method="update", args=[{"yaxis":{"type": "linear"}}]),
dict(label="Log", method="update", args=[{"yaxis":{"type": "log"}}]),
]),
)])
#UPDATE Y AXIS HERE
fig.update_layout( updatemenus=[
dict(
buttons=list([
dict(label="Linear-ID",
method="relayout",
args=[{"yaxis.type": "linear"}]),
dict(label="Log-ID",
method="relayout",
args=[{"yaxis.type": "log"}]),
]),
)])
fig.show()
Is there a way to use a button to update the scale to sqrt ?




