将多个geom_line添加到ggplot

时间:2015-09-15 14:06:39

标签: r ggplot2

geom_line CUR_MTH_UNEARN_REV_EUR正确地绘制为数字。我的目标是添加第二个数字geom_line(即CUR_MTH_EARN_REV_EUR)。这是代码:

library("ggthemes")
library("gridExtra")
library("grid")

p = ggplot(f, aes(DTE_OF_REPORT_EUR, CUR_MTH_UNEARN_REV_EUR, label=(CUR_MTH_UNEARN_REV_EUR)))
+ geom_point(size=ifelse(f$CUR_MTH_UNEARN_REV_EUR<8.0, 11, 5), color=ifelse(f$CUR_MTH_UNEARN_REV_EUR<8.0, '#CC0000', 'black')) 
+ geom_line(size=2,aes(group=1)) + geom_rangeframe() + theme_wsj() 
+ theme(axis.text.x=element_text(angle=50, size=20, vjust=0.7)) 
+ geom_smooth(aes(group=1), method="loess", colour = "#CC0000", lwd=2) 
+ geom_text(aes(label=CUR_MTH_UNEARN_REV_EUR), hjust=-0.5, vjust=0.5, fontface="bold") 
+ ggtitle("Unearned Revenue by Service Code 'BS', in CSG Months, Jul. 2014-Aug. 2015") 
+ theme(plot.title = element_text(lineheight=.8, face="bold"))

p

Text1 = textGrob("Source: Revenue Assurance and Quality Control", gp=gpar(fontsize=7))
p2 = p + annotation_custom(grob = Text1, ymin = -0.2, ymax = -30)

p2

format(round(f$CUR_MTH_UNEARN_REV_EUR, 2), nsmall = 2)
f$ScoreRounded <- round(f$CUR_MTH_UNEARN_REV_EUR, 1)
f$DTE_OF_REPORT_EUR <- factor(f$DTE_OF_REPORT_EUR, levels=unique(as.character(f$DTE_OF_REPORT_EUR)))

1 个答案:

答案 0 :(得分:3)

希望这有助于开始。你可以添加东西,但你需要有正确的答案。

salt-run state.orchestrate orchestration.install_update pillar='{"update_archive_name": "new_archive_name.zip"}'