這與我昨天的question部分相關。向GGPLOT2中的Barplot添加唯一趨勢線
因此,這裏是數據和在ggplot2中創建的圖。
df = data.frame(date=c(rep(2008:2013, by=1)),
value=c(303,407,538,696,881,1094))
ggplot(df, aes(date, value, width=0.64)) +
geom_bar(stat = "identity", fill="#336699", colour="black") +
ylim(c(0,1400)) + opts(title="U.S. Smartphone Users") +
opts(axis.text.y=theme_text(family="sans", face="bold")) +
opts(axis.text.x=theme_text(family="sans", face="bold")) +
opts(plot.title = theme_text(size=14, face="bold")) +
xlab("Year") + ylab("Users (in millions)") +
opts(axis.title.x=theme_text(family="sans")) +
opts(axis.title.y=theme_text(family="sans", angle=90)) +
geom_segment(aes(x=2007.6, xend=2013, y=550, yend=1350), arrow=arrow(length=unit(0.4,"cm")))
是否有可能產生squigly趨勢線在下面的圖表與GGPLOT2
我已經建立了R中的情節,然後在Adobe Photoshop造prettied起來,如果可能,我想知道已經在R中產生了那條曲線趨勢線。
如果ggplot2中無法完成這個任務,那麼是否有任何特定的R軟件包可用於此任務?
我不問關於再現圖表。這不是問題。只是產生趨勢線似乎是一個問題。
在某種程度上,這條線的曲率是否由數值的數值決定?我懷疑ggplot可能會得到陰影,但最後應該是一個帶有箭頭的數學定義曲線。 –
@布萊恩不,它不是數學確定的。陰影不是太重要,只是線條不是直線。 – ATMathew
如果@Hadley在這裏,我敢打賭他會說他希望ggplot2不可能這樣做。 – joran