Skip to content

data with date index doesn't plot correctly #1864

@williambdean

Description

@williambdean

Same issue with this : pandas-dev/pandas#54485

self.plot_data(ax=ax, plot_total_sales=plot_total_sales)
# plot posterior predictive distribution of sales for each of the existing products
x = cast(pd.DataFrame, self.X).index.values
existing_products = self.coords["existing_product"]
for i, existing_product in enumerate(existing_products):
az.plot_hdi(
x,
self.predictions[variable] # type: ignore
.transpose(..., "time")
.sel(existing_product=existing_product),
fill_kwargs={
"alpha": HDI_ALPHA,
"color": f"C{i}",
"label": "Posterior predictive (HDI)",
},
smooth=False,
)

By not using the plot method of pandas, we can get away from this as shown in the linked pandas issue

data.plot(ax=ax)
if plot_total_sales:
data.sum(axis=1).plot(label="total sales", color="black", ax=ax)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcustomer choiceRelated to customer choice modulegood first issueGood for newcomers . Doesn't require extensive knowledge of the repo and packageplots

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions