简体   繁体   中英

How do i remove the x axis 0 line on a plotly chart with streamlit?

I have a plotly chart visualized with streamlit, but when I load it on the hosted streamlit service {appname}.streamlit.app , it applies a black horizontal like at 0 that doesn't show up on local host.

Any idea on how to fix this?

showline = False doesn't seem to work in the xaxis or yaxis update layout method either

[EXPECTED] Local Host Chart (No horizontal black line at 0) 在此处输入图像描述

Incorrected chart displaying on the streamlit hosted service 在此处输入图像描述

Edit (adding code):

price_data = btc_price()

drawdown_fig = px.line(price_data, x=price_data.Date, y=price_data.Price, title=f'Significant Bitcoin Drawdowns')

drawdown_fig.update_layout(
    font=dict(
        family="Proxima Nova",
        size=12,
        color="Black"
    ),
    plot_bgcolor='rgba(0,0,0,0)',
    showlegend = False,
    xaxis=dict(
        title=None,
        showgrid=False,
        showline=False,
    ), 
    yaxis=dict(
        title=None,
        showgrid=False,
        showline=False,

    ),
)


drawdown_fig.update_traces(line_color='#27B296', line_width=1)

drawdown_fig.add_annotation(x=dt.date(2011, 6, 1), 
            y=5500,
            text="Jun 2011<br>-99%",
            showarrow=False,
            )

#removed the other annotations here for simplicity / to save space

st.plotly_chart(drawdown_fig)

Try to modify your yaxis configuration to add zeroline=False . I am pretty sure that would remove the horizontal black line at 0 on the hosted streamlit service.

yaxis=dict(
    title=None,
    showgrid=False,
    showline=False,
    zeroline=False,
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM