[R] Alpha not working in geom_rect
adel daoud
daouda at newschool.edu
Mon Mar 9 23:24:23 CET 2015
Hi Jim,
Thanks for the input but that did not work. I am suing Rstudio by the way
and I guess that has a better device that would support ggplot output.
The annotate options works but that does not explain why the geom_area does
not work:
annotate("rect", xmin=2, xmax=10, ymin=0, ymax=1, fill="black", alpha=0.5)
Best
Adel
--
Adel Daoud, PhD, Researcher
The New School for Social Research,
Visiting Scholar in the Economics Department,
6 East 16th Street New York, NY 10003,
daouda at newschool.edu
University of Gothenburg
Department of Sociology and Work Science,
Box 720
405 30, Göteborg, Sweden
Visiting address: Sprängkullsgatan 25, room F411
Sprängkullsgatan 25, room K109
+46 031-786 41 73
Adel.daoud at sociology.gu.se
On Sun, Mar 8, 2015 at 12:46 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
> Hi Adel,
> Almost certainly because the device you were using doesn't support
> transparency.Try it with a PDF device and check the resulting file in a PDF
> reader:
>
> pdf("ad.pdf")
> print(p)
> dev.off()
>
> Jim
>
>
> On Sun, Mar 8, 2015 at 4:39 AM, Adel <adel.daoud at socav.gu.se> wrote:
>
>> Hi
>> I am trying to activate the alpha argument to work, but for some reason it
>> does not to play with me. Anybody has an idea why?
>>
>>
>> p <- ggplot(data = prediction_df, aes(x=x, y=prediction, fill=threshold))
>> +
>> geom_area(colour="black", size=.2, alpha=.4) +
>> scale_fill_brewer(palette="Set1",
>> breaks=rev(levels(prediction_df$threshold)))
>> p + geom_rect(aes(xmin=2, xmax=10, ymin=(0), ymax=(1)), fill="black",
>> alpha=0.5)
>>
>>
>> prediction_df
>> x prediction threshold
>> 1 -10 0.5694161 noAF
>> 2 -9 0.5700513 noAF
>> 3 -8 0.5706863 noAF
>> 4 -7 0.5713211 noAF
>> 5 -6 0.5719556 noAF
>> 6 -5 0.5725899 noAF
>> 7 -4 0.5732240 noAF
>> 8 -3 0.5738578 noAF
>> 9 -2 0.5744914 noAF
>> 10 -1 0.5751247 noAF
>> 11 0 0.5757578 noAF
>> 12 1 0.5763906 noAF
>> 13 2 0.5770232 noAF
>> 14 3 0.5776556 noAF
>> 15 4 0.5782876 noAF
>> 16 5 0.5789195 noAF
>> 17 6 0.5795510 noAF
>> 18 7 0.5801823 noAF
>> 19 8 0.5808134 noAF
>> 20 9 0.5814441 noAF
>> 21 10 0.5820747 noAF
>> 22 -10 0.2359140 singleAF
>> 23 -9 0.2356847 singleAF
>> 24 -8 0.2354550 singleAF
>> 25 -7 0.2352249 singleAF
>> 26 -6 0.2349943 singleAF
>> 27 -5 0.2347634 singleAF
>> 28 -4 0.2345321 singleAF
>> 29 -3 0.2343003 singleAF
>> 30 -2 0.2340682 singleAF
>> 31 -1 0.2338356 singleAF
>> 32 0 0.2336027 singleAF
>> 33 1 0.2333694 singleAF
>> 34 2 0.2331357 singleAF
>> 35 3 0.2329016 singleAF
>> 36 4 0.2326671 singleAF
>> 37 5 0.2324322 singleAF
>> 38 6 0.2321969 singleAF
>> 39 7 0.2319613 singleAF
>> 40 8 0.2317253 singleAF
>> 41 9 0.2314889 singleAF
>> 42 10 0.2312522 singleAF
>> 43 -10 0.1946699 multipleAF
>> 44 -9 0.1942640 multipleAF
>> 45 -8 0.1938587 multipleAF
>> 46 -7 0.1934540 multipleAF
>> 47 -6 0.1930500 multipleAF
>> 48 -5 0.1926467 multipleAF
>> 49 -4 0.1922440 multipleAF
>> 50 -3 0.1918419 multipleAF
>> 51 -2 0.1914404 multipleAF
>> 52 -1 0.1910397 multipleAF
>> 53 0 0.1906395 multipleAF
>> 54 1 0.1902400 multipleAF
>> 55 2 0.1898411 multipleAF
>> 56 3 0.1894429 multipleAF
>> 57 4 0.1890453 multipleAF
>> 58 5 0.1886483 multipleAF
>> 59 6 0.1882520 multipleAF
>> 60 7 0.1878564 multipleAF
>> 61 8 0.1874613 multipleAF
>> 62 9 0.1870669 multipleAF
>> 63 10 0.1866732 multipleAF
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Alpha-not-working-in-geom-rect-tp4704291.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>>
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list