R markdown 中的图例

发布于 2025-01-19 17:14:16 字数 605 浏览 4 评论 0原文

我无法弄清楚如何在MarkdownR中使用图形拟合传奇。

我的结果看起来像这样。

“”

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)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨落成白 2025-01-26 17:14:16

可悲的是,我没有足够的代表将其作为评论,但是您可能会对

ggplot(xyz) + scale_color_xxx(guide = guide_legend(keywidth = xxx, keyhight = xxx)) 

这条代码感兴趣,可以使您可以详尽地自定义传奇,但是对我来说,总是涉及很多反复试验和错误。比我在gude_legend()中使用的参数要多得多。祝你好运!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文