Open bhargavkakadiya opened 8 months ago
Hey @bhargavkakadiya , thanks for reaching out.
Unfortunately this is something that has been on my to-do list for a while now.
The best I can do for you is the years_as_columns=True
option, which will plot horizontally but still separating the years.
import numpy as np
import pandas as pd
from plotly_calplot.calplot import calplot
# mock setup
dummy_start_date = "2022-12-01"
dummy_end_date = "2023-10-03"
dummy_df = pd.DataFrame(
{
"ds": pd.date_range(dummy_start_date, dummy_end_date, tz="Singapore"),
"value": np.random.randint(
-10,
30,
(pd.to_datetime(dummy_end_date) - pd.to_datetime(dummy_start_date)).days
+ 1,
),
}
)
fig1 = calplot(
dummy_df,
x="ds",
y="value",
years_as_columns=True
)
fig1.show()
When I end up doing the 12 month trailing plot, it will be a separate function to calplot and I'll mention this issue in the release.
Thanks @brunorosilva the update and closest solution to task. Great of see TTM plot function is coming up; would you able to share when could we expect this? I gave it a try but I wasn't able to wrap my mind around everything with time range, labels, layout, etc
I'll check it over the weekend to see if it's as easy as I'm thinking and give you an estimate. The code is quite overwhelming and verbose, honestly this is a bit of Plotly's fault haha.
Hey mate, I tried to work on it over the weekend but it's harder than I thought. I'll keep on working on it and give another update once it's closer to a solve.
thanks for the update and trying out @brunorosilva I have moved to different representation for now and hope to see this feature and try it out soon
Is it possible to have plot combining two different years for use case such as: trailing 12 months? So w.r.t. to given Image, expected result which starts at month Feb and ends at Jan in a single row