Streamlit plotly x axis more frequent

Hi everyone,

May I know how can I make the x axis label more frequent?

Thank you!

Hi dear @rjiogjreio

You can set the label of axis like x axis as following:

fig.update_xaxes(title_text='x',title_font=dict(size=18, family='Courier', color='black')) 

But I didn’t understand what you mean of more frequent? would you tell me more about exactly what do you mean (or tell an example)?

Hi Bijan,

Thanks for replying me!
For instance, I plotted a line graph between Feb-2016 to Jan-2023
The graph shows 8 x-axis point such as 2016, 2017, 2018…

However, I would like to have more x-axis point such as Jun 2016, Jun 2017 … in the middle

Thank you!

Dear @rjiogjreio

I think now I undestood your purpose. Take a look to the following sample:

#Set ticks text
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(
    go.Scatter3d(
        x=[-1, 2, 3],
        y=[-1, 3, 1],
        z=[-2,6,4]))

fig.update_layout(scene = dict(    xaxis = dict(
                                         showticklabels=True,
                                         title='',
                                         tickmode='array',
                                         tickvals=[-1,0,1,2,3],
                                         ticktext=['2017','2016-June','2017','2017-June','2018'],
                                                  ), ))
fig.show()