[R] ggplot2 - deprecated guide= argument in

hadley wickham h.wickham at gmail.com
Wed Sep 17 18:29:19 CEST 2008


On Wed, Sep 17, 2008 at 5:34 AM, Pedro Barros <pedro.barros at fao.org> wrote:
>
> In the help for scale_fill_identity, it is written
>  ## Not run:
>         colour <- c("red","green","blue","yellow")
>         qplot(1:4, 1:4, fill=colour, geom="tile")
>         qplot(1:4, 1:4, fill=colour, geom="tile") + scale_fill_identity()
>
>         # To get a legend, you also need to supply the labels to
>         # be used on the legend, and the grob to draw them:
>         # grob_tile, grob_line, or grob_point
>         qplot(1:4, 1:4, fill=colour, geom="tile") +
> scale_fill_identity(labels=letters[1:4], guide="tile", name="trt")
>
> This code used to work with ggplot2. However, after updating to the newer
> version (version 0.6) and R 2.7.2, I get the following error message:
> Error in get("new", env = ScaleIdentity, inherits = TRUE)(ScaleIdentity,  :
>  unused argument(s) (guide = "tile")
>
> If I omit the guide="tile" argument, I still get a tile, but I did like the
> option for choosing the grob to use.
> How should I go about this?

You can no longer select the geom to use for drawing the legend - it's
chosen automatically based on the geoms that you included in the plot.
 Is there a geom in particular that you don't like the legend for?

Hadley


-- 
http://had.co.nz/



More information about the R-help mailing list