Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS_Heatmap #58

Open
AnningerChris opened this issue Apr 3, 2021 · 3 comments
Open

TS_Heatmap #58

AnningerChris opened this issue Apr 3, 2021 · 3 comments

Comments

@AnningerChris
Copy link

Good Day,
it seems that x-axis label is hardcoded to "YEAR", but in case of plotting weekly seasons with daily observations, this is wrong.
ts_heatmap_example_covid
Best Regards, Christian
PS: Thanks for your work on TSStudio!!!

@RamiKrispin
Copy link
Owner

@AnningerChris thanks for the feedback. could you please share a reproducible example?

A quick fix (until will fix and release to CRAN) as the modify the x-axis labels using plotly layout:

library(TSstudio)
library(plotly)

p <- ts_heatmap(ts.obj = my_data)

p %>%
layout(xaxis = list(title = "Week"))

@AnningerChris
Copy link
Author

@RamiKrispin well let me try to create a working example like this one:

library(TSstudio)
library(lubridate)
date <- as.Date(seq(as.Date("2020-02-26"):as.Date("2021-04-01")), origin = "2020-02-26")
ts_ex_df <- data.frame(date)
ts_ex_df$data <- rnorm(401,2,1)
ts_ex <- ts(ts_ex_df$data,
start = c(isoweek(min(ts_ex_df$date)), as.numeric(wday(min(ts_ex_df$date), week_start = 1))),
end = c(isoweek(max(ts_ex_df$date))+57, as.numeric(wday(max(ts_ex_df$date), week_start = 1))),
frequency = 7)
ts_heatmap(ts_ex)

Many thx for the quickfix!

@RamiKrispin
Copy link
Owner

Here is a temp fix:

library(lubridate)
library(plotly)
date <- as.Date(seq(as.Date("2020-02-26"):as.Date("2021-04-01")), origin = "2020-02-26")
ts_ex_df <- data.frame(date)
ts_ex_df$data <- rnorm(401,2,1)
ts_ex <- ts(ts_ex_df$data,
            start = c(isoweek(min(ts_ex_df$date)), as.numeric(wday(min(ts_ex_df$date), week_start = 1))),
            end = c(isoweek(max(ts_ex_df$date))+57, as.numeric(wday(max(ts_ex_df$date), week_start = 1))),
            frequency = 7)


ts_heatmap(ts_ex) %>%
  layout(title = "My title",
         xaxis = list(title = "Week"))

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants