I'm trying to build several graphs of element x Al2O3 using one column (Sample) for the shape and another (Feature) for the color of the points.
This is the database with 19 rows and only two elements (Al3O3 and MgO):
dput(SenAssuncao)
structure(list(Sample = c("SA-2021-04", "SA-2021-04", "SA-2021-04",
"SA-2021-04", "SA-2021-04", "SA-2021-03", "SA-2021-03", "SA-2021-03",
"SA-2021-03", "SA-2021-03", "SA-2021-02", "SA-2021-02", "SA-2021-02",
"SA-2021-02", "SA-2021-02", "SA-2021-01", "SA-2021-01", "SA-2021-01",
"SA-2021-01"), Feature = c("Light", "Light", "Mix", "Mix", "Layer",
"Mix Light I Ti", "Mix II", "Main Ca", "Mix II", "Mix Light I",
"Dark", "Blur", "Dark Cl", "Fracture Light", "Mix Mass", "Be pure",
"Be pure", "Be rock", "Be rock"), Al2O3 = c(1.0381, 0.8721, 8.7012,
11.3049, 1.2254, 10.7386, 15.025, 3.72, 17.7018, 11.258, 2.6827,
14.9632, 2.253, 3.2849, 0.9544, 22.1522, 20.7351, 20.5441, 22.6549
), MgO = c(1e-06, 1.327, 1e-06, 1e-06, 1e-06, 1.1713, 1.0625,
1e-06, 1.6261, 1.5062, 1e-06, 1e-06, 1e-06, 1.4719, 1.4962, 1.237,
2.0311, 0.8032, 1e-06), LegendGroup = c("SA-2021-04 Light", "SA-2021-04 Light",
"SA-2021-04 Mix", "SA-2021-04 Mix", "SA-2021-04 Layer", "SA-2021-03 Mix Light I Ti",
"SA-2021-03 Mix II", "SA-2021-03 Main Ca", "SA-2021-03 Mix II",
"SA-2021-03 Mix Light I", "SA-2021-02 Dark", "SA-2021-02 Blur",
"SA-2021-02 Dark Cl", "SA-2021-02 Fracture Light", "SA-2021-02 Mix Mass",
"SA-2021-01 Be pure", "SA-2021-01 Be pure", "SA-2021-01 Be rock",
"SA-2021-01 Be rock")), row.names = c(NA, -19L), class = c("tbl_df",
"tbl", "data.frame"))
Using this code, only 9 out of 19 rows are plotted:
SenAssuncao$LegendGroup <- paste(SenAssuncao$Sample, SenAssuncao$Feature, sep = " ")
LableSymbols <- c(17,17,17,17,17, # 5 SA-2021-04
15,15,15,15,15, # 5 SA-2021-03
18,18,18,18,18, # 5 SA-2021-02
20,20,20,20) # 4 SA-2021-01
LabelFeatures <- as.character(SenAssuncao$LegendGroup)
print(ggplot(SenAssuncao) +
geom_point(aes(x= Al2O3, y= MgO,
shape = LegendGroup, colour = LegendGroup)) +
ylab("MgO (wt%)") + xlab("Al2O3 (wt%)") +
scale_y_continuous(labels=function(x) format(x, scientific = FALSE)) +
scale_color_manual(name = "Sample and Feature",
labels = LabelFeatures,
values = colorRampPalette(brewer.pal(19, "Set1"))(length(SenAssuncao$LegendGroup))) +
scale_shape_manual(name = "Sample and Feature",
labels = LabelFeatures,
values = LableSymbols) +
guides(color = guide_legend(ncol=2)) +
theme(legend.position="right", legend.text = element_text(size = 6),
legend.title = element_text(size = 7)))
So I'd like to know what I need to do to plot the entire dataset.