Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change font size in Euler plot in R?

Tags:

plot

r

eulerr

I am trying to create a Euler diagram in R using the eulerr package. I would like to reduce the font size of the quantities text on the plot.

I have tried using cex=0.5 (as per example below) and have also tried fontsize = and font = but none have reduced the font size. Am I placing cex=0.5 in the wrong position?

    library(eulerr)

    set1 <- euler(c("A&B" = 3103,
            "A&C" = 1034,
            "A&D" = 118,
            "B&C" = 2690,
            "B&D" = 1017,
            "C&D" = 1383,
            "A&B&C" = 394,
            "A&B&D" = 73,
            "A&C&D" = 45,
            "B&C&D" = 153,
            "A&B&C&D" = 32))

    eulerr.plot <- plot(set1,
                fills = list(fill = c("#009292", "#FFB6DB", "#B66DFF", "#6DB6FF"), alpha = 0.7),
                labels = NULL, quantities = TRUE, legend = list(labels = c("A", "B", "C", "D")), cex = 0.5)
like image 856
emily Avatar asked Dec 03 '25 16:12

emily


1 Answers

You can change the text size of the quantities by passing a list defining the size to that argument like so:

plot(set1,  fills = list(fill = c("#009292", "#FFB6DB", "#B66DFF", "#6DB6FF"), alpha = 0.7),
                    labels = NULL, quantities = list(cex = .5), legend = list(labels = c("A", "B", "C", "D")))

enter image description here

like image 120
Ritchie Sacramento Avatar answered Dec 05 '25 07:12

Ritchie Sacramento



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!