[R] Problem with adding labels in ggplot2
Zeljko Vrba
zvrba at ifi.uio.no
Wed May 27 13:40:52 CEST 2009
I apologize for not pasting a complete example, but the data-set is too large,
so I hope someone can help me just by description of symptoms.
I define a generic plot object name (note the missing y=.. in aes()) to
plot different y-values against the same set of x-values.
p.b4.generic.wg <-
ggplot(subset(b4.all.medians, ncpus==8, TRUE), aes(x=wg)) +
geom_line(aes(linetype=graph, group=interaction(graph,nwrk,ncpus))) +
geom_point(aes(shape=nwrk)) +
scale_shape(name="# of workers") + scale_linetype(name="Workload") +
xlab("Work division") + ylab("N/A")
Now,
p.b4.stealspins <- p.b4.generic.wg + aes(y=v.stealspins / v.realtime) +
ylab("Steal rate")
draws the correct graph EXCEPT that the y-axis label is wrong. The ylab() is
ignored and the y-label is set to "v.stealspins / v.realtime". What am I
doing wrong here?
More information about the R-help
mailing list