0

I'm facing some difficulties to set my background plot with some transparency. simply, whenever I set alpha to any value, same opaque background is returned. Although there is some posts regarding background highlighting such as

customize background to highlight ranges of data in ggplot

How to highlight time ranges on a plot?

ggplot2: highlight chart area

But unfortunately, this issue is not discussed here or there. I would appreciate your comments

Here is some data for demo

install.packages("ggplot2")

First , using geom_rect

ggplot(mtcars, aes(x=wt, y=qsec)) + 
geom_point(color="black",size=8) + 
theme_bw() +
geom_rect(aes(xmin=4,xmax=5,ymin=14,ymax=Inf),alpha=0.9,fill="green")

Playing with alpha wont help and ultimately, that is what I got

data from mtcars

Using annotate function , I can not generate it also.

Community
  • 1
  • 1
Samehmagd
  • 473
  • 1
  • 5
  • 13

1 Answers1

1

Your value for alpha is too high.

enter image description here