How to nicely annotate a ggplot2 (manual)

前端 未结 3 1359
逝去的感伤
逝去的感伤 2020-11-30 18:38

Using ggplot2 I normally use geom_text and something like position=jitter to annotate my plots.

However - for a nice plot I of

3条回答
  •  青春惊慌失措
    2020-11-30 19:35

    If you use geom_text() instead of annotate() you can pass a group color to your plot:

    ggplot(data2, aes(x=time, y=value, group=type, col=type))+
    geom_line()+
    geom_point()+
    theme_bw() +
    geom_text(aes(7, .9, label="correct color", color="NA*")) +
    geom_text(aes(15, .6, label="another correct color!", color="MVH")) 
    

    So using annotate() it looks like this: alt text http://www.cerebralmastication.com/wp-content/uploads/2010/03/before.png

    then after using geom_text() it looks like this: alt text http://www.cerebralmastication.com/wp-content/uploads/2010/03/after.png

提交回复
热议问题