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

label_size in ggarrange() ? #38

Closed
G-Thomson opened this issue Sep 29, 2017 · 4 comments
Closed

label_size in ggarrange() ? #38

G-Thomson opened this issue Sep 29, 2017 · 4 comments

Comments

@G-Thomson
Copy link

In cowplot the plot.grid() function has the label_size option to change the size of labels?

Could this be implemented in ggarrange() too?

@G-Thomson
Copy link
Author

see pull request #39

@kassambara
Copy link
Owner

Hi,

as the argument font.label is used in many ggpubr functions (see ggboxplot) to customize labels, I keep the same naming convention for ggarrange().

New arguments in ggarrange() to customize plot labels:
- font.label
- label.x and label.y
- hjust and vjust

Examples:

library(ggpubr)
data("ToothGrowth")
df <- ToothGrowth
df$dose <- as.factor(df$dose)

# Create some plots
# ::::::::::::::::::::::::::::::::::::::::::::::::::
bxp <- ggboxplot(df, x = "dose", y = "len",
    color = "dose", palette = "jco")
dp <- ggdotplot(df, x = "dose", y = "len",
    color = "dose", palette = "jco")
dens <- ggdensity(df, x = "len", fill = "dose", palette = "jco")

# Arrange
# ::::::::::::::::::::::::::::::::::::::::::::::::::
ggarrange(bxp, dp, dens, ncol = 2, nrow = 2,
          labels = c("A", "B", "C"),
          font.label = list(size = 16, color = "red"))

rplot

@kassambara kassambara reopened this Oct 9, 2017
kassambara added a commit that referenced this issue Oct 9, 2017
@PabloAFi
Copy link

Nice. It really works

@blueandtanit
Copy link

blueandtanit commented Feb 10, 2020

Hi, I'm beginner with R and I'm learning for my thesis data analysis (and fancy custom presentation of results), I want to know how can i center the graphic labels, because it looks on the y axis at the boxplot.

I'm using this code:
ggarrange(q, s, u, w, y, d, f, h, j, ncol = 3, nrow = 3,
labels = c("LT", "LA", "LE", "TD", "LH", "L1", "L2", "L3", "L1L2"),
font.label = list(size = 16, color = "black"), common.legend = TRUE, legend = "top")
for the plots (example):
p<-ggplot(data, aes(x=Embalse, y=LT, fill=Embalse)) +
geom_boxplot()
q <- p+ stat_summary(fun.y=mean, geom="point", shape=1, size=3)+theme_classic()+theme(axis.title = element_blank())
and same for the rest variables.

UPDATE:
tried with hjust=-8, vjust= 0.6 but can't get all panel labels centered, some are more at the left and some more at the right, and some, yes, centered (it's a 3x3 panels-plots).

what's wrong?
thanks for your help.

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

4 participants