I am currently attempting to use ggplot to create a bar chart with a single bar that is partially transparent.
I have the following code:
dt1 <- data
First you put the alpha
inside the aes
as suggested by @jazzurro. However, you should use factor
for this to get a discrete scale. Then you can manually adjust the alpha scale.
ggplot() + geom_bar(data=dt1, aes(x=yr, y=val, fill=x, alpha=factor(alphayr)), stat="identity") +
scale_x_continuous(breaks=dt1$yr) +
scale_alpha_manual(values = c("0.5"=0.5, "1"=1), guide='none')