[R] help with ggplot backgrounds

Hadley Wickham hadley at rice.edu
Mon Nov 14 06:34:04 CET 2011


You are more likely to receive helpful responses if you:

a) Provide a reproducible example (e.g.
https://github.com/hadley/devtools/wiki/Reproducibility)

b) Post to the ggplot2 mailing list.

Hadley

On Fri, Oct 28, 2011 at 5:03 PM, RanRL <rnrlrn at gmail.com> wrote:
> Hi, I have two questions regarding plotting of this dataset:
>
> Product Color    StoreA StoreB StoreC   Price
>
> A          Red      4          2        3        78
>            Blue      5          2        2       78
>           Greem    4         3         2       80
>
> B          Red       3     ................
>
> And so on (Not all products have same colors).
>
> I made 2 plots: one is a scatter where x=Price and y=Values (of different
> stores). The different stores are facet_wrapped, and Color is indicated by
> point color while Product by point_shape.
> Second plot is a polar plot of geom_bars with position="dodge" for all
> Products to differentiate the colors. The y value is the value for each
> store (Price is not represented).
>
> My questions:
> 1. for the first plot, I want to make a background area split into 3, top
> right is red (indicating high-price/high-values), middle is yellow, the rest
> is green (these are kind of reverse-log areas, like in heat maps).
>
> 2. for the second plot, the red-yellow green are just background geom_rects
> filled in, but I cant figure out how to specify the xmin and xmax for this
> (since they are discrete variables).
>
> Any help will be appreciated, thanks.
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/help-with-ggplot-backgrounds-tp3949320p3949320.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list