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

Guides aren't working in 1.0.5 and ggplot2 3.5.0 #33

Open
araikes opened this issue Aug 14, 2024 · 1 comment
Open

Guides aren't working in 1.0.5 and ggplot2 3.5.0 #33

araikes opened this issue Aug 14, 2024 · 1 comment

Comments

@araikes
Copy link

araikes commented Aug 14, 2024

Hi @csdaw,

I really like this package but have run into an issue. I have ggprism v 1.0.5 and ggplot2 v 3.5.1.

I get the following:

> ggplot(dorr_data, aes(x = sex, y = tbv, fill = sex)) +
+   stat_slab(side = "left", scale = 0.75, position = "dodge") +
+   stat_dotsinterval(scale = 0.5, position = "dodge", alpha = 0.5) +
+   stat_pointinterval(.width = .5,  # set to a scalar to draw only one label instead of two
+                      position = position_dodge(width = 1),
+                      size = 8
+   ) +
+   scale_fill_manual(values = c("#AB0520", "#0C234B")) +
+   facet_wrap( ~ allele_header) +
+   scale_y_continuous(limits = c(400, 525), expand = c(0,0),
+                      breaks = seq(400,525,25), guide = "prism_offset") +
+   labs(x = "",
+        y = expression(paste("Total brain volume (",mm^3,")", sep = ""))) +
+   theme(
+     plot.title = element_text(vjust = -0.5, size = 12),   # plot title size and position
+     axis.title.y = element_text(size = 15),
+     axis.text.y = element_text(size=12),        # y-axis text size
+     axis.text.x = element_text(size = 12),   # x-axis text size/face
+     strip.text = element_text(size = 15),
+     legend.position = "none")
Warning message:
The S3 guide system was deprecated in ggplot2 3.5.0.
ℹ It has been replaced by a ggproto system that can be extended.

The resultant plot has the right y-axis range but doesn't produce brackets:

image

Any thoughts on getting this work?

@araikes
Copy link
Author

araikes commented Aug 19, 2024

I figured it out. The vignette is out of date. Should be:

> ggplot(dorr_data, aes(x = sex, y = tbv, fill = sex)) +
+   stat_slab(side = "left", scale = 0.75, position = "dodge") +
+   stat_dotsinterval(scale = 0.5, position = "dodge", alpha = 0.5) +
+   stat_pointinterval(.width = .5,  # set to a scalar to draw only one label instead of two
+                      position = position_dodge(width = 1),
+                      size = 8
+   ) +
+   scale_fill_manual(values = c("#AB0520", "#0C234B")) +
+   facet_wrap( ~ allele_header) +
+   scale_y_continuous(limits = c(400, 525), expand = c(0,0),
+                      breaks = seq(400,525,25)) +
+   labs(x = "",
+        y = expression(paste("Total brain volume (",mm^3,")", sep = ""))) +
+   guides(y = "prism_offset") +
+   theme(
+     plot.title = element_text(vjust = -0.5, size = 12),   # plot title size and position
+     axis.title.y = element_text(size = 15),
+     axis.text.y = element_text(size=12),        # y-axis text size
+     axis.text.x = element_text(size = 12),   # x-axis text size/face
+     strip.text = element_text(size = 15),
+     legend.position = "none")

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