A graph of random values is plotted. It is necessary to change the values of the Y axis to others.
xg = np.random.rand(100, 1200)
fig = px.imshow(xg, aspect="auto",color_continuous_scale='ice')
fig.show()
values to be changed
y1=np.arange(100)*0.5
y2=np.arange(100)*5
Thanks!
import numpy as np
import plotly.express as px
xg = np.random.rand(100, 1200)
fig = px.imshow(xg, aspect="auto",color_continuous_scale='ice')
# y1
fig.update_layout(yaxis={"tickmode":"array","tickvals":np.arange(10)*10, "ticktext":np.arange(10)*5}).show()
# y2
fig.update_layout(yaxis={"tickmode":"array","tickvals":np.arange(10)*10, "ticktext":np.arange(10)*50}).show()
"visible":False
does not work. So there are two identical traces on top of each otherimport numpy as np
import plotly.express as px
xg = np.random.rand(100, 1200)
fig = px.imshow(xg, aspect="auto", color_continuous_scale="ice").add_traces(
px.imshow(xg, aspect="auto", color_continuous_scale="ice")
.update_traces(yaxis="y2")
.data
)
fig.update_layout(
xaxis={"domain": [0.05, 1]},
yaxis={
"tickmode": "array",
"tickvals": np.arange(10) * 10,
"ticktext": np.arange(10) * 50,
},
yaxis2={
"tickmode": "array",
"tickvals": np.arange(10) * 10,
"ticktext": np.arange(10) * 5,
"anchor": "free",
"position": 0,
"autorange": "reversed",
},
).show()