The parameter alpha in the R package ggplot2 is used to express the transparency of the fill colour of the function geom_

However for the function geom_rect it might not work as aspected.

In my latest work, I tried to combine different geom function but I was stuck when all was covered when I used geom_rect.

Let’s see an example:

If we plot the data using geom_jitter and geom_boxplot we obtain the plot:

Now, if we can introduce the coordinates for geom_rect with the following

But if we add geom_rect the results are not what we want.

The alpha parameter seem not to work.

This is due to the fact that geom_rect adds as many shapes as the number of entries.

This nullifies the parameter alpha.

Therefore, in order to produce our ideal plot we have to reduce the entries of the dataset:

And to rewrite the plot function: