scale_size errors?

191 views
Skip to first unread message

Pbleic

unread,
Mar 15, 2012, 1:12:26 PM3/15/12
to ggplot2
I have been trying to get scale_size to work with published examples.
Each time I use it, I get:

> p + scale_size(to=c(1,10))
Error in continuous_scale("size", "size_c",
rescale_pal(range), ...) :
unused argument(s) (to = c(1, 10))

Has something changed with ggplot2?

Here is an example:

p <- qplot(mpg, cyl, data=mtcars, size=cyl)
p + scale_size("cylinders")
p + scale_size(to = c(0, 10))
print(p)

Dennis Murphy

unread,
Mar 15, 2012, 1:51:02 PM3/15/12
to Pbleic, ggplot2
Hi:

In the new version of ggplot2 (0.9.0), many of the functions
pertaining to scales were rewritten and put into the scales package,
which is not autoloaded with ggplot2. The to = argument of
scale_size() in 0.8.9 has been changed to range = in the scales
package. So the short answer to your question is to use instead

p + scale_size(range=c(1,10))

If it doesn't work 'out of the box' with ggplot2-0.9.0, load the
scales package and try again. Your reproducible example worked for me
when I made the above change.

Dennis

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

Reply all
Reply to author
Forward
0 new messages