I have made a chart with rectangles alpha depending on values:
ggplot(data = df_ch1,aes(IMPORTANCE, PERFORMANCE)) + geom_point(aes(size = N), alpha = 0.2) + facet_wrap(~Attitude, labeller = label_wrap_gen(30))+
theme_light()+ labs(fill = "Classification")+
theme(axis.text.x = element_text(angle=45, hjust = 1), #legend.position = 'none',
strip.text = element_text(size = 12, face = "bold"))+
scale_size(range = c(5,10))+
geom_text(aes(x = 1.5, y = 1.5,label = label4))+
geom_text(aes(x = 3.5, y = 3.5,label = label1))+
geom_text(aes(x = 3.5, y = 1.5,label = label2))+
geom_text(aes(x = 1.5, y = 3.5,label = label3))+
scale_x_discrete(labels = c("Very unimportant", "Somewhat unimportant", "Somewhat important", "Very Important"))+
#geom_rect(aes(xmin = 2.55, xmax = 4.45, ymin= 0.55, ymax = 2.45,alpha = rect_color_dw1), fill = "darkred")+
scale_alpha(range = c(0, 0.1), breaks = (c(0, 0.2, 0.4, 0.6, 0.8, 1)), labels = percent(c(0, 0.2, 0.4, 0.6, 0.8, 1)/2)) +
geom_rect(data = df_ch1, aes(xmin = 2.55, xmax = 4.45, ymin= 2.55, ymax = 4.45, alpha = rect_color_up1), fill = 'darkgreen', inherit.aes = T) +
labs(alpha = "Percentage")
It looks good:
However, when I add second rectangle (just uncomment comented line) scale legend switches to grayscale, which is completly nonintuitive:
I want to have two alpha coloured scales (red and green). Is it possible to make it?
Best Regards Tomasz