I'm trying to color sections of a target that I have created. I like the color selection. I'm trying to make the transparency of an individual ring less than the surrounding rings. For example, in the picture below for the second circle in... I only want the second ring from the outside to be highlighted (or darker). Does that make sense at all? My code so far is as follows:
#install.packages("ggforce") # for geom_circle()
library(ggplot2)
library(ggforce)
circle_data <- data.frame(
x0 = c(rep(0.5,4),rep(3,4),rep(5.5,4),rep(8,4)),
y0 = c(rep(3,4),rep(3,4),rep(3,4),rep(3,4)),
r = c(rev(seq(0.1, 1, length.out = 4)),rev(seq(0.1, 1, length.out = 4)),rev(seq(0.1, 1, length.out = 4)),rev(seq(0.1, 1, length.out = 4))),
col = c(rev(c(seq(1,4))),rev(c(seq(1,4))),rev(c(seq(1,4))),rev(c(seq(1,4))))
)
circle_data_add2 <- data.frame(
x0 = rep(3,1),
y0 = rep(3,1),
r = rev(seq(0.1, 1, length.out = 4))[2],
col = rev(c(seq(1,4)))[2]
)
circle_data_add1 <- data.frame(
x0 = rep(0.5,1),
y0 = rep(3,1),
r = rev(seq(0.1, 1, length.out = 4))[1],
col = rev(c(seq(1,4)))[1]
)
circle_data_add3 <- data.frame(
x0 = rep(5.5,1),
y0 = rep(3,1),
r = rev(seq(0.1, 1, length.out = 4))[3],
col = rev(c(seq(1,4)))[3]
)
circle_data_add4 <- data.frame(
x0 = rep(8,1),
y0 = rep(3,1),
r = rev(seq(0.1, 1, length.out = 4))[4],
col = rev(c(seq(1,4)))[4]
)
ggplot()+
geom_circle(aes(x0 = x0,y0 = y0,r = r,fill = col,col = col),alpha = 0.15,data = circle_data)+
coord_fixed()+
scale_fill_gradient(low = "red", high = "blue")+
scale_color_gradient(low = "red", high = "blue")+
geom_circle(aes(x0 = x0,y0 = y0,r = r,fill = col,col = col),alpha = 0.6,data = circle_data_add1,inherit.aes = FALSE)+
geom_circle(aes(x0 = x0,y0 = y0,r = r,fill = col,col = col),alpha = 0.6,data = circle_data_add2,inherit.aes = FALSE)+
geom_circle(aes(x0 = x0,y0 = y0,r = r,fill = col,col = col),alpha = 0.6,data = circle_data_add3,inherit.aes = FALSE)+
geom_circle(aes(x0 = x0,y0 = y0,r = r,fill = col,col = col),alpha = 0.6,data = circle_data_add4,inherit.aes = FALSE)+
theme(
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.ticks = element_blank(),
axis.text = element_blank(),
legend.position = "none"
)+
xlab("")+
ylab("")
This is the output of the current code:
And my desired output, in which only a certain ring is highlighted, is the following:



