arrow head missing on line segment

44 views
Skip to first unread message

Jim Porzak

unread,
Jun 2, 2009, 3:17:42 PM6/2/09
to ggplot2
I must be missing something simple!
I'm attempting to annotate a line plot with arrows & text.

toy example:
library(ggplot2) #ggplot2 version 0.8.3
p <- qplot(1:10, 2:3, geom = "line")
p
p + geom_segment(aes(4, 2.5, xend = 6, yend = 2.5, arrow=arrow
(length=unit(0.1,"cm"))))

misses arrow head.
Have tried various lengths.

> R.version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 9.0
year 2009
month 04
day 17
svn rev 48333
language R
version.string R version 2.9.0 (2009-04-17)

TIA,
Jim

baptiste auguie

unread,
Jun 2, 2009, 4:09:01 PM6/2/09
to Jim Porzak, ggplot2
Hi,

try with arrow outside the aes() function,

p + geom_segment(aes(x=4, y=2.5, xend = 6, yend = 2.5), arrow=arrow
(length=unit(0.1,"cm")))

HTH,

baptiste
--
_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

http://newton.ex.ac.uk/research/emag
______________________________

Jim Porzak

unread,
Jun 2, 2009, 4:31:08 PM6/2/09
to ggplot2
Thanks Baptiste! Just like in Hadley's example - which I've been
staring at all morning!! -Jim
Reply all
Reply to author
Forward
0 new messages