在成功连接直线图的间隙后,似乎无法对面积图进行连接。面积图是否可能达到我对折线图所做的效果?i、 e.连接间隙,而不是将间隙绘制为零?
折线图的结果是:
面积图的结果为:
面积图代码:
Area chart
titles = '<br>'.join(wrap(Columns_to_show, 90))
plotly_fig_area = px.area(data_frame=Dataframe_to_display,x=pd.to_datetime(Dataframe_to_display.index).strftime("%Y-%m-%d"),y=Dataframe_to_display['Czechia gov deficit/surplus'], title=titles)
# Legend settings
plotly_fig_area.update_layout(showlegend=False)
plotly_fig_area.update_layout(margin_autoexpand=True) # prevent size from changing because of legend or anything
plotly_fig_area.update_traces(mode="lines", hovertemplate=None)
plotly_fig_area.update_layout(hovermode="x unified")
plotly_fig_area.update_traces(connectgaps=True)
# Background colour
plotly_fig_area.layout.plot_bgcolor="white"
折线图代码:
plotly_fig = px.line(data_frame=Dataframe_to_display,x=Dataframe_to_display.index,y=Dataframe_to_display['Czechia gov deficit/surplus'])
# Legend settings
plotly_fig.update_layout(showlegend=False)
plotly_fig.update_layout(margin_autoexpand=True) # prevent size from changing because of legend or anything
plotly_fig.update_layout(hovermode="x unified")
plotly_fig.update_traces(connectgaps=True)
#grids
plotly_fig.update_xaxes(showgrid=False) # Removes X-axis grid lines
plotly_fig.update_yaxes(showgrid=False) # Removes Y-axis grid lines
# Background colour
plotly_fig.layout.plot_bgcolor="white"
暂无答案!
目前还没有任何答案,快来回答吧!