X axis formatting in category type

Hey there,

My original issue stems from not being able to omit missing dates in the Xaxis, which causes unsightly gaps in a bar chart. To get around this I use the xaxis type category however this changes the formatting for dates to โ€œYYYY-MM-DDโ€ although have have defined formats and spaces. Does category change the data to a string?

code:

layout = go.Layout(
                autosize = True,
                title = '',
                font = {
                       "family": "Raleway",
                       "size": 12,
                       "color": "white"
                       },
                barmode = 'stack',
                xaxis = { 'type': 'category','tickformat': '%-d/%b', 'dtick': 'M1' },
                yaxis = { 'title': '', 'showgrid': False},
                legend = { 'orientation': 'h'},
                paper_bgcolor=colors['transparent'],
                plot_bgcolor=colors['plotbg'],
                margin = {
                        "r": 50,
                        "t": 50,
                        "b": 50,
                        "l": 50
                        },
                )

chart looks as such however.

image

which isnโ€™t ideal.

Any idea how I can reformat categories type?

thanks

Iโ€™m facing the same issue. How can we format the axes when set to category?

@Jman did you find a solution?

Unfortunately not, I ended up leaving the weekend gaps in and setting the labels to the first of the month

layout = go.Layout(
                    autosize = True,
                    title = '',
                    font = {
                           "family": "Raleway",
                           "size": 12,
                           "color": "white"
                           },
                    xaxis = {'tickformat': '%-d/%b', 
                             'dtick': 'M1',
                             },
                    yaxis = { 'title': 'Daily delivery mcm', 'showgrid': False},
                    legend = { 'orientation': 'h'},
                    paper_bgcolor=colors['transparent'],
                    plot_bgcolor=colors['plotbg'],
                    margin = {
                            "r": 50,
                            "t": 50,
                            "b": 20,
                            "l": 50
                            },
                    )

image

Yes :slight_smile:

That said, we now support range-breaks which allow you to drop weekends from date axes: Time series and date axes in Python