Hi, I need X Axis 2 to show the tick values but it isnβt. How do I do this? Example below:
import pandas as pd
from plotly.subplots import make_subplots
import plotly.graph_objects as go
new = pd.DataFrame({'x': {0: 0.0, 1: 0.0, 2: 0.0, 73: 1.0, 74: 1.0, 75: 1.0},
'y': {0: 0, 1: 1, 2: 2, 73: 0, 74: 1, 75: 2},
'radius_colour': {0: 15.0,
1: 10.0,
2: 0.0,
73: 30.52867504494749,
74: 20.0,
75: 45.0},
'radius_grey': {0: 37.36308338453881,
1: 40.0,
2: 0.0,
73: 37.36308338453881,
74: 50.0,
75: 45.0},
'avg': {0: 0.045278808816197724,
1: 0.7121718328920527,
2: 0.6833861594662105,
73: 0.23490077280964838,
74: 0.5113549060324999,
75: 0.8362329029189804}})
fig = make_subplots(rows=1, cols=1)
fig.add_trace(
go.Scatter(
x=new["x"],
y=new["y"],
mode="markers",
marker=dict(
size=new["radius_grey"],
color="LightGrey",
opacity=0.4,
),
showlegend=False
)
).add_trace(
go.Scatter(
x=new["x"],
y=new["y"],
mode="markers",
marker=dict(
size=new["radius_colour"],
color=new["avg"],
colorscale="Viridis",
showscale=True,
),
showlegend=False,
)
)
fig.update_layout(
xaxis=dict(
side="bottom",
title="X Axis",
tickvals=[0.5],
ticktext=['X_1_0'],
rangeslider=dict(visible=True)
),
xaxis2=dict(
side="top",
title="X Axis 2",
tickvals=[0,1],
ticktext=['A', 'B']
),
yaxis=dict(
showgrid=False,
showline=True,
linecolor="rgb(102, 102, 102)",
tickvals=[0,1,2],
ticktext=['Y_0','Y_1','Y_2'],
title="Y Axis",
autorange="reversed",
),
paper_bgcolor="white",
plot_bgcolor="white",
)
fig.show()