Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

How to show all x-axis tick labels on a go.Bar chart

Hi guys, I would like all x-axis ticsk displaying the date, currently every 2nd bar is showing date as shown in the figure below:

‘’’
fig_data_usage = px.bar(unit_df, x=‘DATE’, y=‘KILOBYTES’)

fig_data_usage = go.Figure(data=[go.Bar(

    x=date,

    y=daily_usage,

    text=daily_usage,

    textposition='auto',

    hovertemplate ='%{y}<extra></extra>',

)])

# Style Barchart

fig_data_usage.update_traces(

    marker_color=color.BLUE,

    marker_line_color=color.NAVY_BLUE,

    marker_line_width=1.5,

    opacity=0.6

)

# Style Title

fig_data_usage.update_layout(

    # title_text='Unit Upload File Size',

    title='<b>Daily Data Usage</b>',

    xaxis_tickformat = '%d %b',

    yaxis_ticksuffix=' kB',

   

    **get_title_stlye()

)

‘’’

Hey,

So you will want to set the x ticks as such: 24 hours, 60 minutes per hour, 60 seconds per minute, 1000 milliseconds per second.

fig.update_xaxes(dtick=24*60 * 60 * 1000)

Thanks mate. No idea why that worked by it did.

Datetimes are nothing more than a numerical value (milliseconds since epoch)