I am trying to create a scatterplot with pesticide concentrations from week 1 on the x axis and from week 2 on the y axis. I would like to make those who live near an agricultural field one color filled in, and those who live far from an agricultural field another color with a hollow symbol. I would also like to make those who did not follow the intervention to be a different symbol (such as a triangle).
I have figured out how to change the color for near/far field and how to change the symbol based on those who didn't follow the intervention, but cannot for the life of me figure out how to change the fill for the near-field participants.
I have tried various iterations with both geom_point and scale_shape_manual and can't get it to work. Here is some of the code I have tried:
geom_point(aes(shape=exclusion, fill=Field), size=3) +
scale_x_continuous(trans = "log", breaks = c(0, 0.1, 0.5, 1.0),
limits = c(NA, 1.2)) +
scale_y_continuous(trans = "log", breaks = c(0, 0.1, 0.5, 1.0),
limits = c(NA, 1.2)) +
guides(colour = guide_legend(title="Residenital Proximity\nto
Agricultural Field")) +
scale_color_discrete(labels = c("Far Field", "Near Field")) +
labs(y="Urinary glyphosate concentration (ug/L) conventional
week", x="Urinary glyphosate (ug/L) organic week"
geom_abline(slope=1, intercept=0) +
theme_minimal() +
theme(strip.text = element_blank (),
legend.title = element_blank(),
legend.position = "none")
I have also tried:
ggplot(data=data_scatter, aes(x=result_org, y=result_conv)) +
geom_point(aes(color=factor(Field),
shape=factor(excl_3))) +
scale_shape_manual(values=c(1, 2, 16, 17)) +
scale_x_continuous(trans = "log", breaks = c(0, 0.1, 0.5, 1.0),
limits = c(NA, 1.2)) +
scale_y_continuous(trans = "log", breaks = c(0, 0.1, 0.5, 1.0),
limits = c(NA, 1.2)) +
guides(colour = guide_legend(title="Residenital Proximity\nto
Agricultural Field")) +
labs(y="Urinary glyphosate concentration (ug/L) conventional
week", x="Urinary glyphosate concentration (ug/L) organic
week") +
geom_abline(slope=1, intercept=0) +
theme_minimal()
When I do this, I get the following image, where I have the difference in color/shape, but not fill 1