I'm making a plot with 100 different ellipses in ggplot2. I want the ellipses/polygons on the plot to be slightly translucent so that the areas with the most lines on them become darker, whereas areas with one ellipse would be quite faint.
The opacity I want vs the opacity im currently getting
However, no matter what I change alpha to, it doesn't seem to have an effect? What am I doing wrong?
ggplot(data = cssibernobk, aes(iso1, iso2)) +
scale_fill_manual(name = "Marlin Species", labels = c("Blue Marlin", "Striped Marlin"),values=c(col_list)) +
geom_polygon(data = ellipse_dfcs,
show.legend = FALSE,
mapping = aes(iso1, iso2,
group = ellipse_dfcs$group,
color = factor(group),
fill = factor(group)), fill = NA, alpha = 0.2) +
scale_color_manual(values = col_list)+
geom_point(colour="black", shape=21, size = 2,
aes(fill = factor(group))) +
ylab(expression(paste(delta^{34}, "S (\u2030)")))+
xlab(expression(paste(delta^{13}, "C (\u2030)")))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))
I've added some data:
dput(cssibernobk[1:10,])
structure(list(iso1 = c(-19.0666624548854, -17.8943955612859,
-18.9928609367509, -16.4710761874456, -18.2727144857982, -20.5069897964015,
-20.5966996037602, -17.5454265065267, -16.4393689881177, -17.4617536511442
), iso2 = c(19.4934410976126, 19.2364832949763, 19.7701196888491,
19.837594669008, 19.7147010622141, 20.3802264543413, 20.4655925249838,
19.0895171633117, 19.7264242586365, 19.2537859386917), group = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1), community = c(1, 1, 1, 1, 1, 1, 1,
1, 1, 1)), row.names = c(NA, -10L), class = c("tbl_df", "tbl",
"data.frame"))
dput(ellipse_dfcs[1:10,])
structure(list(id = c("1", "1", "1", "1", "1", "1", "1", "1",
"1", "1"), iso1 = c(-15.3019878272902, -15.4740783680741, -15.6530442971316,
-15.8381649818314, -16.0286950065133, -16.2238671740144, -16.4228955949008,
-16.6249788519676, -16.8293032272625, -17.0350459786413), iso2 = c(20.3654052739855,
20.44444500941, 20.5195305006846, 20.5903594050369, 20.6566465194678,
20.718124929163, 20.7745470822651, 20.8256857866775, 20.8713351248865,
20.9113112831188), community = c("1", "1", "1", "1", "1", "1",
"1", "1", "1", "1"), group = c("1", "1", "1", "1", "1", "1",
"1", "1", "1", "1")), row.names = c(NA, 10L), class = "data.frame")
Cheers for the help!



