filmov
tv
How to Rotate Annotated Text in ggplot2 Plot in R (Example) | Add Label with Specific Degree & Angle

Показать описание
R code of this video:
y = 5:1)
library("ggplot2") # Load ggplot2 package
ggp <- ggplot(data, aes(x, y)) + # ggplot2 plot without text label
geom_point()
ggp
ggp + # Regular text label
annotate("text",
x = 2, y = 3,
label = "This Is My Text Label")
ggp + # Annotate rotated text label
annotate("text",
x = 2, y = 3,
label = "This Is My Text Label",
angle = 90)
Follow me on Social Media:
y = 5:1)
library("ggplot2") # Load ggplot2 package
ggp <- ggplot(data, aes(x, y)) + # ggplot2 plot without text label
geom_point()
ggp
ggp + # Regular text label
annotate("text",
x = 2, y = 3,
label = "This Is My Text Label")
ggp + # Annotate rotated text label
annotate("text",
x = 2, y = 3,
label = "This Is My Text Label",
angle = 90)
Follow me on Social Media: