сюжетная подстановка общего xaxis строки даты нежелательно - PullRequest
0 голосов
/ 20 сентября 2019

график 4.1.1

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

x = ["2019-09-01", "2019-09-02", "2019-09-04"]
fig = make_subplots(rows=2, cols=1, shared_xaxes=True)
fig.add_trace(go.Bar(x=x, y=[1, 2, 3], name="1st"), row=1, col=1) 
fig.add_trace(go.Bar(x=x, y=[3, 2, 1], name="2nd"), row=2, col=1) 
fig.update_layout(xaxis={'type': 'category'})
fig.show()

Ниже, субплот 1-й правильно отображается на xaxis типа категории , но 2-й застрял на xasis типа date нежелательно.

enter image description here

1 Ответ

0 голосов
/ 20 сентября 2019

update_xaxes вместо update_layout (xaxis) решило проблему.

fig.update_xaxes(type='category', row=1, col=1)
fig.update_xaxes(type='category', row=2, col=1)
...