2
x軸考慮簡單的例子:註釋文本使用GGPLOT2
library(ggplot2)
head(mtcars)
# create the plot
ggplot(mtcars, aes(factor(cyl))) + geom_bar() + theme_bw() +
theme(strip.text.x = element_text(size = 20, face="bold"))+
xlab("number of cyl") + ylab("Count")
現在我們可以得到平均$mpg
每cyl
有:
aggregate(mpg ~ cyl, data = mtcars, FUN=mean)
我怎樣才能把這些平均值爲X以使它們出現在對應的cyl
之下。一個可以繪製表格,不知怎麼寫,這是每缸的......平均MPG ...
也許這會有所幫助:http://stackoverflow.com/questions/16680063/how-can-i-add-a-table-to-my-ggplot2-output – beetroot
是否有使用特定的原因'facet_grid'代替'ggtitle()'在劇情上放置一個標題?這可能會給潛在的答案增加不必要的複雜性。 – Uwe
不,讓我們刪除它 – user08041991