Search code examples
pythonplotlystacked-bar-chart

Plotly/Python: How to fill/expand monthly time-series to fill the x-axis?


Is there a way without expanding the dataset to fill the gaps between bars?

My code for the chart:

    xaxis={
        'title':"",
        'tick0':chartdata[chartdata.Date > date].index[0],
        'dtick':'M1',
        'tickformat':'%b\n%Y',
        'tickangle':-45,
    },
    yaxis={
        'title':"<b>Gross</b> Balances",
        'tickprefix':'$',
        'nticks':20,
        'showgrid':True,
    },
    barmode='stack',

Current view: stacked bar chart

Currently it is only displaying the bar @ month-end (according to the dataset) and there is a lot of white space between bars.


Solution

  • I believe the solution I was looking for was:

    fig.update_traces(
       xperiod="M1"
    )