2017-06-22 75 views
0

使用的自定義x軸內置R中的數據集ToothGrowthGGPLOT2:加星號的一些標籤

ggplot(ToothGrowth, aes(x=dose,y=len,colour=supp)) + 
    geom_point() 

有沒有辦法來添加一個星號部分x軸的標籤?例如1.0和2.0?

回答

3

如何:

library(ggplot2) 
    ggplot(ToothGrowth, aes(x=dose,y=len,colour=supp)) + 
    geom_point() + scale_x_continuous(breaks = seq(0.5, 2, 0.5), 
             ,labels = c("0.5","1*","1.5", "2*")) 

enter image description here