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

getGlobalXInfo truncates to nearest quarter #264

Open
HomoCodens opened this issue Sep 26, 2018 · 2 comments
Open

getGlobalXInfo truncates to nearest quarter #264

HomoCodens opened this issue Sep 26, 2018 · 2 comments

Comments

@HomoCodens
Copy link
Collaborator

When trying to get exact plots of windows that start/end at any month that is more annoying than useful.

@HomoCodens
Copy link
Collaborator Author

HomoCodens commented Jan 15, 2019

This also leads to problems with the KOF Monatsblätter.
Example:

x <- generate_random_ts(3, starts = 2018 + 6/12, lengths = 5)

tt <- init_tsplot_theme(
  fill_year_with_nas = FALSE,
  show_x_axis = FALSE,
  use_bar_gap_in_groups = FALSE
)

tsplot(x, left_as_bar = TRUE, group_bar_chart = TRUE, theme = tt)

usr_coords <- par("usr")
axis(
  1,
  seq(usr_coords[1], usr_coords[2], length.out = 6),
  hadj = -0.5,
  padj = -0.9
)

Here the bar groups should be evenly spaces across the whole plot to correspond with the manually drawn ticks.
The example below makes it clear, that tsplot draws an additional empty month to fill the quarter:

x <- generate_random_ts(3, starts = 2018 + 6/12, lengths = 5)

tt2 <- init_tsplot_theme(
  fill_year_with_nas = FALSE,
  use_bar_gap_in_groups = FALSE
)

tsplot(x, left_as_bar = TRUE, group_bar_chart = TRUE, theme = tt2)

@HomoCodens
Copy link
Collaborator Author

HomoCodens commented Jan 15, 2019

I guess this can be worked around with manual_ticks_x:

x <- generate_random_ts(3, starts = 2018 + 6/12, lengths = 5)

tt <- init_tsplot_theme(
  fill_year_with_nas = FALSE,
  use_bar_gap_in_groups = FALSE,
  show_x_axis = FALSE
)

bla <- tsp(x$ts1)

tsplot(x,
      left_as_bar = TRUE,
      group_bar_chart = TRUE,
      theme = tt,
      manual_ticks_x = seq(bla[1], bla[2] + 1/bla[3], by = 1/bla[3]))

usr_coords <- par("usr")
axis(
  1,
  seq(usr_coords[1], usr_coords[2], length.out = 6),
  c("Jul", "Aug", "Sept", "Okt", "Nof", ""),
  hadj = -0.5,
  padj = -0.9
)

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

1 participant