help with inserting text in a graph

31 views
Skip to first unread message

Antonio P. Ramos

unread,
Dec 13, 2012, 7:09:48 PM12/13/12
to ggp...@googlegroups.com
Hi all,

I am using a very simple code to add a text to a graph:

ggplot(my.subset,aes(time.transit,child_mortality, group=as.factor(country.x),colour=as.factor(my.democracy)))+
  geom_line()  + geom_vline(xintercept = 0,size=1,linetype=2)+   xlab(expression("Years to and from Democratic Transition")) +   
  xlab(expression("Years to and from Democratic Transition")) + m +ylab(expression("Child Mortality Rates")) +
  ylab(expression("Child Mortality Rates")) +  theme(legend.position="none") + 
  geom_text(aes(25, .37, label="Democracy")) + geom_text(aes(-25, .37, label="Dictatorship")) +
  ggtitle("Transitions and  Mortality Trajectories") 


However, geom_text() is producing very ugly results (see attached). Any clue why?

Thanks in advance
ugly.png

David Kahle

unread,
Dec 13, 2012, 10:29:53 PM12/13/12
to Antonio P. Ramos, ggp...@googlegroups.com
Cool!  Checked out ?annotate.

Cheers
david.

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
<ugly.png>

Brian Diggs

unread,
Dec 14, 2012, 11:16:27 AM12/14/12
to Antonio P. Ramos, ggplot2
See http://stackoverflow.com/q/10952832/892313 for a discussion of this
and my answer as to fix it.

> Thanks in advance
>


--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University
Reply all
Reply to author
Forward
0 new messages