Black Lives Matter. Please consider donating to Black Girls Code today.

Shared_x axis with subplots, can't use suffix

Hello!

My problem is, that when I create multiple plots with subplots, and the x_axis is shared, the suffix on x_axis is not shown.

The code i use:

from plotly.subplots import make_subplots
import plotly.graph_objects as go

fig = make_subplots(rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.05)

fig.add_trace(
go.Bar(x=[1, 2, 3], y=[4, 5, 6]),
row=1, col=1
)

fig.add_trace(
go.Bar(x=[2, 3, 4], y=[5, 6, 7]),
row=2, col=1
)

fig.update_layout(height=600, width=800, title_text=“Subplots”, xaxis=dict(ticksuffix="%"))
fig.show()

Can anybody help, what I do wrong?

Thanks in advance!

I found an answer somewhere else, so if somebody has the same issue:

import plotly.graph_objects as go
from plotly.subplots import make_subplots

fig = make_subplots(rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.05)

fig.add_trace(
go.Bar(x=[1, 2, 3], y=[4, 5, 6]),
row=1, col=1
)

fig.add_trace(
go.Bar(x=[2, 3, 4], y=[5, 6, 7]),
row=2, col=1
)

fig.update_layout(height=600, width=800, title_text='Subplots')
fig.update_xaxes(dict(ticksuffix="%"))
fig.show()