'Legend in R markdown
I can´t figure it out how to fit a legend with a graph in Markdown R.
My result looks like this.
plot_druhych_davek = ockovani %>%
ggplot(aes(x=datum,y=druhych_davek, color = kraj_nazev))+ #+ scale_y_log10()
geom_line(alpha = 0.8)+
labs(title = str_wrap( sprintf("Průběh druhých dávek očkování od: %s DO: %s", OD, DO),40) ,
x = "Datum",
y = "Počet dávek",
color = "kraj_nazev")+
theme_fivethirtyeight()+
theme(axis.title = element_text()) +
theme(legend.title = element_blank())
plot(plot_druhych_davek)
Solution 1:[1]
Sadly I dont have enough Rep to put this as a comment but you might be interested in
ggplot(xyz) + scale_color_xxx(guide = guide_legend(keywidth = xxx, keyhight = xxx))
this line of code lets you customize your legend quite granularily, however for me always involves a lot of trial and error. There are much more arguments than the ones I used within guide_legend()
. Good luck!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Agnosie |