shading area with date format

I am trying to shade my data for the particular date range (x-axis).
But, the shading area coming very dark, even I am setting my alpha = 0.01

geom_rect(aes(xmin=ymd('2020-03-25'),
                    xmax = ymd('2020-05-30'),
                    ymin = -Inf,
                    ymax = Inf),  alpha = 0.01, fill="pink")

please let me know how to make it more transparent.

Thanks
Kunal

geom_rect() is drawing a box for each row in your dataframe that is why you get a dark color, since you are not mapping any variable to an aesthetic I think you should use annotate()

annotate("rect", ymd('2020-03-25'),
                    xmax = ymd('2020-05-30'),
                    ymin = -Inf,
                    ymax = Inf,
             alpha = 0.01, fill="pink")

Thanks for the reply. But it is showing an error:
Error: geom_rect requires the following missing aesthetics: xmin
Run rlang::last_error() to see where the error occurred.
In addition: Warning message:
Ignoring unknown aesthetics: x

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.