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

ggts axis breaks do not align between continuous and discrete variables #464

Open
FMKerckhof opened this issue Mar 20, 2023 · 0 comments
Open

Comments

@FMKerckhof
Copy link


When using ggts with both categorical and numerical variables the time breaks (and axes) are not aligned.
This is already clear from the documentation here but a reprex can be found below.

Essentially the breaks (and the axes) are not the same for the continuous and discrete data (here with +geom_vline(xintercept=1970) on top of the reprex below:
image

While the differences are minute they can complicate interpretation and defeat the purpose of this visualisation. Is this a known bug? Can it be circumvented?

the reprex is a direct extract from the documentation:

library(ggplot2)
library(GGally)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2

data(pigs)
pigs_dt <- pigs[-(2:3)] # remove year and quarter
pigs_dt$profit_group <- as.numeric(pigs_dt$profit > mean(pigs_dt$profit))

# make the profit group as a factor value
profit_groups <- c(
  "1" = "high",
  "0" = "low"
)
pigs_dt$profit_group <- factor(
  profit_groups[as.character(pigs_dt$profit_group)],
  levels = unname(profit_groups),
  ordered = TRUE
)

pigs_types <- list(
  comboHorizontal = wrap(ggally_facethist, binwidth = 1)
)

ggts(pigs_dt, "time", 2:7, types=pigs_types)

Created on 2023-03-20 with reprex v2.0.2

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