I want to build a graph with ggplot using geom_line. I made up the following reprex to expose the problem:
library(ggplot2)
data <- data.frame(Value = rnorm(20),
Obs = c(1:10,1:10),
Var = c(rep("A", 10), rep("B", 10)),
Alpha = c(rep(0.7, 10), rep(0.99, 10)))
ggplot(data, aes(x = Obs, y = Value, col = Var, alpha = Alpha)) +
geom_line()
Created on 2020-07-09 by the reprex package (v0.3.0)
I want the "A" variable to be a little bit more transparent than the "B" variable. So I set alpha to 0.7 and 0.99 inside the dataframe for "A" and "B" respectively. However, this produces a plot with "A" much more transparent than "B". In fact, changing alpha to say 0.95 does not change the appearance at all.
I would be very thankful for some guidance.