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

Make facet formulas compatible with density plots #104

Merged
merged 5 commits into from
Jan 26, 2024

Conversation

grantmcdermott
Copy link
Owner

Fixes #103.

The problem examples from that issue all work properly now.

pkgload::load_all("~/Documents/Projects/plot2")
#> ℹ Loading plot2

aq = airquality
aq$hot = ifelse(aq$Temp>=75, "hot", "cold")
aq$windy = ifelse(aq$Wind>=15, "windy", "calm")

with(
  aq,
  plot2(
    Ozone, 
    type = "density",
    facet = windy ~ hot,
    fill = "by",
    grid = TRUE, frame = FALSE, 
    main = "Ozone pollution is worse on hot, calm days"
  )
)

plot2(
  ~ Ozone,
  data = aq, 
  type = "density",
  facet = windy ~ hot,
  fill = "by",
  grid = TRUE, frame = FALSE, 
  main = "Ozone pollution is worse on hot, calm days"
)

plot2(
  ~ Ozone,
  data = subset(aq, !is.na(Ozone)), 
  type = "density",
  facet = windy ~ hot,
  fill = "by",
  grid = TRUE, frame = FALSE, 
  main = "Ozone pollution is worse on hot, calm days"
)

Created on 2024-01-25 with reprex v2.0.2

@grantmcdermott grantmcdermott merged commit e78c77d into main Jan 26, 2024
3 checks passed
@grantmcdermott grantmcdermott deleted the facet_fml_density branch January 26, 2024 07:24
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

Successfully merging this pull request may close these issues.

facet formulas don't play nice with type = "density"
1 participant