Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Add two values in different rows in ggplot as text

I have this dataset:
structure(list(new = c("No: 0.91", "Yes: 0.89", "All: 0.84")), row.names = c(NA,
-3L), class = c("tbl_df", "tbl", "data.frame"))
And I would like to create a plot with only the text like:
enter image description here

But the text to be one below the other. So you have any idea?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

One option would be to use nudge_y to shift the labels:

library(ggplot2)

ggplot() +
  geom_text(aes(
    x = 1, y = 1,
    label = c("No: 0.91", "Yes: 0.89", "All: 0.84")
  ), nudge_y = .05 * c(1, 0, -1))

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading