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

ggarange common.legend positioning overwritten #184

Closed
cscheeder opened this issue Apr 12, 2022 · 0 comments
Closed

ggarange common.legend positioning overwritten #184

cscheeder opened this issue Apr 12, 2022 · 0 comments

Comments

@cscheeder
Copy link

cscheeder commented Apr 12, 2022

If I run the code below the common legend at the bottom of the combined plot is not centered but left aligned. If I run the code without attaching cowplot the ggarange works as expected.
Note: I chose ggarange over grid_arrange for the convenient common.legend option.

library(tidyverse)
library(ggpubr)
library(cowplot)
#> 
#> Attaching package: 'cowplot'
#> The following object is masked from 'package:ggpubr':
#> 
#>     get_legend
theme_set(theme_cowplot())

p1 <- iris %>% 
  ggplot(aes(x=Sepal.Width,y=Petal.Width,color=Species)) + 
  geom_point() + coord_fixed()


p2 <- iris %>% 
  ggplot(aes(x=Sepal.Width,y=Petal.Width,color=Species)) + 
  geom_point() + coord_fixed()


ggarrange(p1,p2,ncol=2,
          labels=c("A","B"),
          common.legend = T,
          legend = "bottom")

Created on 2022-04-12 by the reprex package (v2.0.1)

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