I have graph where I compare the growth of a wildtype and mutant plant root in different situations. For this, I already upload my excel data in a graph with jitter and bloxpot. I like it, but want to make all wildtype measurement in a color and mutant in other.
Here's my input:
ggplot(Raiz, aes(x = G, y = T)) +
geom_jitter(position = position_jitter(width = 0.2), alpha = 0.5) +
geom_boxplot(width = 0.5, color = "black", alpha = 0.2, position = position_dodge(0.9)) +
theme_minimal() + theme( plot.background = element_rect(fill = "white") ,
panel.grid.minor = element_blank()
)
And here's how my graph is:
I wanna make 1,3,5,7... one color and 2,4,6,8... other color. Simple as that. Can you help me please?
I tried using ChatGPT but it didnt help
Data
Raiz <- structure(list(G = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 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10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L), levels = c("1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15", "16"), class = "factor"),
T = c(0.266, 0.264, 0.253, 0.257, 0.27, 0.282, 0.273, 0.261,
0.265, 0.28, 0.288, 0.306, 0.272, 0.26, 0.291, 0.28, 0.276,
0.309, 0.267, 0.285, 0.253, 0.269, 0.256, 0.263, 0.291, 0.287,
0.275, 0.272, 0.273, 0.286, 0.293, 0.292, 0.289, 0.276, 0.272,
0.309, 0.291, 0.29, 0.272, 0.288, 0.289, 0.3, 0.28, 0.288,
0.286, 0.281, 0.286, 0.283, 0.28, 0.28, 0.275, 0.283, 0.285,
0.294, 0.283, 0.269, 0.284, 0.286, 0.273, 0.282, 0.271, 0.291,
0.274, 0.282, 0.279, 0.308, 0.281, 0.273, 0.298, 0.283, 0.283,
0.294, 0.287, 0.284, 0.276, 0.275, 0.282, 0.293, 0.295, 0.271,
0.284, 0.277, 0.295, 0.276, 0.282, 0.291, 0.308, 0.291, 0.274,
0.277, 0.281, 0.302, 0.274, 0.285, 0.653, 0.659, 0.718, 0.661,
0.658, 0.657, 0.646, 0.666, 0.638, 0.708, 0.712, 0.736, 0.735,
0.549, 0.695, 0.69, 0.585, 0.701, 0.644, 0.645, 0.632, 0.683,
0.591, 0.739, 0.65, 0.773, 0.669, 0.625, 0.677, 0.606, 0.655,
0.684, 0.667, 0.636, 0.727, 0.661, 0.726, 0.709, 0.714, 0.72,
0.785, 0.675, 0.77, 0.647, 0.62, 0.675, 0.677, 0.662, 0.589,
0.663, 0.573, 0.642, 0.599, 0.631, 0.608, 0.646, 0.693, 0.646,
0.642, 0.741, 0.707, 0.792, 0.652, 0.663, 0.589, 0.611, 0.614,
0.681, 0.757, 0.702, 0.718, 0.69, 0.666, 0.491, 0.724, 0.711,
0.71, 0.763, 0.746, 0.633, 0.693, 0.582, 0.675, 0.684, 0.68,
0.694, 0.688, 0.667, 0.623, 0.706, 0.707, 0.743, 0.684, 0.726,
1.11, 1.032, 1.135, 1.135, 1.126, 1.11, 1.057, 1.091, 1.137,
1.152, 1.132, 1.213, 1.163, 1.017, 1.075, 1.054, 1.047, 1.113,
1.098, 1.135, 1.142, 1.133, 1.043, 1.209, 1.152, 1.211, 1.127,
1.042, 1.111, 1.008, 1.142, 1.164, 1.155, 1.045, 1.148, 1.081,
1.144, 1.119, 1.129, 1.144, 1.121, 1.082, 1.123, 1.075, 1.037,
1.096, 1.081, 1.055, 0.975, 1.084, 0.914, 1.042, 0.98, 1.059,
1.023, 1.046, 1.075, 1.014, 1.015, 1.147, 1.159, 1.286, 1.135,
1.126, 1.061, 1.176, 1.085, 1.127, 1.144, 1.109, 1.101, 1.178,
1.082, 0.906, 1.092, 1.135, 1.151, 1.151, 1.088, 1.117, 1.148,
0.936, 1.164, 1.077, 1.119, 1.111, 1.037, 1.163, 1.012, 1.182,
1.094, 1.147, 1.137, 1.139, 1.565, 1.495, 1.58, 1.735, 1.58,
1.56, 1.549, 1.524, 1.581, 1.527, 1.493, 1.629, 1.531, 1.43,
1.509, 1.547, 1.498, 1.598, 1.603, 1.641, 1.701, 1.573, 1.525,
1.725, 1.585, 1.648, 1.603, 1.467, 1.508, 1.534, 1.583, 1.562,
1.569, 1.512, 1.591, 1.486, 1.535, 1.588, 1.535, 1.517, 1.554,
1.489, 1.577, 1.632, 1.502, 1.575, 1.555, 1.437, 1.479, 1.589,
1.337, 1.458, 1.44, 1.51, 1.402, 1.549, 1.517, 1.433, 1.484,
1.613, 1.662, 1.725, 1.644, 1.578, 1.43, 1.643, 1.511, 1.532,
1.588, 1.568, 1.53, 1.615, 1.47, 1.362, 1.477, 1.558, 1.626,
1.513, 1.464, 1.555, 1.464, 1.364, 1.692, 1.472, 1.545, 1.574,
1.505, 1.618, 1.471, 1.604, 1.542, 1.564, 1.627, 1.544, 1.986,
2.053, 2.044, 2.291, 2.128, 2.006, 2.016, 2.001, 2.049, 1.997,
1.938, 2.089, 2.029, 1.834, 1.989, 1.957, 1.957, 2.036, 2.097,
2.073, 2.292, 2.066, 1.977, 2.229, 2.094, 2.056, 2.086, 1.928,
1.981, 1.949, 2.019, 2.051, 2.036, 1.968, 1.982, 1.901, 1.874,
2.118, 2.007, 2.089, 1.946, 1.912, 1.99, 2.114, 2.003, 1.941,
1.961, 1.884, 1.886, 2.023, 1.869, 2.009, 1.945, 2.022, 1.853,
2.063, 1.893, 1.943, 1.92, 2.08, 2.162, 2.153, 2.103, 1.994,
1.885, 2.096, 2.004, 1.997, 2.013, 2.063, 1.969, 2.033, 1.893,
1.835, 1.923, 1.949, 2.127, 1.953, 1.906, 2.056, 2, 1.95,
2.003, 1.92, 2.069, 2.036, 1.991, 2.136, 1.951, 2.025, 1.962,
2.021, 2.074, 1.921, 2.603, 2.563, 2.561, 2.874, 2.79, 2.661,
2.648, 2.534, 2.556, 2.477, 2.489, 2.579, 2.574, 2.335, 2.575,
2.515, 2.491, 2.51, 2.68, 2.723, 3.005, 2.639, 2.554, 2.851,
2.737, 2.665, 2.684, 2.61, 2.544, 2.443, 2.597, 2.531, 2.552,
2.466, 2.438, 2.355, 2.328, 2.575, 2.509, 2.603, 2.51, 2.359,
2.597, 2.521, 2.498, 2.373, 2.36, 2.434, 2.439, 2.531, 2.384,
2.499, 2.544, 2.509, 2.369, 2.683, 2.354, 2.517, 2.458, 2.649,
2.745, 2.774, 2.629, 2.472, 2.353, 2.69, 2.482, 2.473, 2.471,
2.579, 2.554, 2.609, 2.365, 2.409, 2.356, 2.472, 2.568, 2.393,
2.353, 2.515, 2.431, 2.452, 2.804, 2.372, 2.677, 2.53, 2.516,
2.786, 2.452, 2.508, 2.505, 2.47, 2.682, 2.322, 3.154, 3.135,
3.105, 3.435, 3.568, 3.226, 3.235, 3.151, 3.134, 2.978, 3.004,
3.124, 3.084, 2.766, 3.124, 3.108, 3.085, 3.026, 3.247, 3.203,
3.751, 3.09, 3.11, 3.452, 3.31, 3.23, 3.295, 3.15, 3.054,
3.112, 3.104, 3.073, 3.114, 3.054, 2.946, 3.007, 2.882, 3.112,
2.96, 3.191, 2.98, 2.86, 3.175, 3.053, 2.992, 2.862, 2.87,
2.901, 2.992, 3.09, 2.945, 3.095, 3.111, 3.117, 2.833, 3.284,
2.757, 3.099, 3.07, 3.25, 3.385, 3.214, 3.179, 3.101, 2.789,
3.217, 3.153, 3.014, 2.955, 3.062, 2.995, 2.921, 2.873, 2.997,
2.973, 3.071, 3.036, 2.874, 2.806, 3.057, 2.982, 2.948, 3.282,
2.939, 3.191, 3.085, 3.067, 3.313, 3.02, 3.029, 3.009, 2.98,
3.21, 2.68, 3.912, 3.944, 3.83, 4.211, 4.302, 3.705, 3.892,
3.802, 3.821, 3.441, 3.747, 3.733, 3.858, 3.471, 3.772, 3.789,
3.791, 3.729, 3.966, 3.785, 4.592, 3.818, 3.879, 4.29, 4.158,
3.884, 3.985, 3.982, 3.775, 3.826, 3.766, 3.778, 3.778, 3.698,
3.574, 3.41, 3.536, 3.864, 3.734, 3.963, 3.62, 3.459, 3.801,
3.769, 3.646, 3.761, 3.826, 3.505, 3.665, 3.732, 3.617, 3.288,
3.845, 3.834, 3.484, 4.007, 3.313, 3.776, 3.756, 3.959, 3.98,
3.802, 3.67, 3.747, 3.245, 3.941, 3.9, 3.711, 3.531, 3.782,
3.792, 3.781, 3.554, 3.684, 3.711, 3.708, 3.694, 3.387, 3.432,
3.69, 3.633, 3.754, 3.903, 3.513, 3.911, 3.824, 3.494, 4.035,
3.712, 3.514, 3.784, 3.597, 3.919, 3.092)), row.names = c(NA,
-752L), class = c("tbl_df", "tbl", "data.frame"))
You can do