Lorenzo Isella
unread,Jun 25, 2012, 8:31:49 AM6/25/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggplot2
Dear All,
Please find an easy snippet at the end of the email.
I am reusing some old code of mine and I noticed that now (on a fresh
ggplot2 installation from the R repositories on a box running Debian
mint), I am experiencing troubles.
When I run my snippet, I get this error message
source('test_ggplot2.R')
Error in structure(list(...), class = "options") :
could not find function "unit"
The problem is given by the line
axis.ticks.length = unit(0.15, "cm")
inside ops(...). However, in the past on another machine, I have never got
any error message for this.
Is my new ggplot2 installation buggy or has anything changed recently in
its syntax?
In that case, what is the correct syntax now?
Many thanks for your help.
Cheers
Lorenzo
#################################################################
library(ggplot2)
mydata <- as.data.frame(cbind(seq(10), seq(10)))
names(mydata) <- c("ratio", "N")
b <- ggplot(mydata, aes(x=N, y=ratio)) +
geom_point(size=2) +
opts( panel.background=theme_rect(fill='white',
size=1.5))+
opts(panel.grid.minor = theme_blank())+
opts(panel.grid.major = theme_blank())+
opts(axis.ticks = theme_segment(colour = "black", size=1)
, axis.ticks.length = unit(0.15, "cm")
)
pdf("test.pdf",width=5,height=5)
print(b)
dev.off()