'Plotly includes dates that are missing from the data in the x-axis
Having financial data, there is no data over weekends/bank holidays/etc. In the example below I used this data set.
Assume having a dateframe where the index consists of timestamps then naively plotting the data using:
import pandas as pd
pd.options.plotting.backend = "plotly"
fig = df["open"].plot()
returns:
which is great... except the straight lines connecting the missing data. Adding:
fig.update_layout(xaxis=dict(type="category"))
Is almost perfect:
How can I now get the same tickers (Year, Month, day without the hours)? Once the index is treated as a category then I cannot use date formatter like %b and co.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


