My dumbbell plot is giving me multiple points on my graph and I am wondering why. I assumed I am supposed to be getting a single point. I have tried editing the parameters but to no avail. it is making it difficult to add other aesthetics. I will appreciate any help.
data10 <- structure(list(GROUP = c("LLL", "LLL", "LLL", "LRL", "LRL", "LRL",
"RLR", "RLR", "RLR", "RRR", "RRR", "RRR"), conditon2 = c("Midline_Ret",
"No Midline crossing_Ret", "Midline crossing_Ret", "Midline_Trans",
"No Midline crossing_Trans", "Midline crossing_Trans", "Midline_Trans",
"No Midline crossing_Trans", "Midline crossing_Trans", "Midline_Ret",
"No Midline crossing_Ret", "Midline crossing_Ret"), Trial_type = c("retention",
"retention", "retention", "transfer", "transfer", "transfer",
"transfer", "transfer", "transfer", "retention", "retention",
"retention"), Training = c("left", "left", "left", "right", "right",
"right", "left", "left", "left", "right", "right", "right"),
N = c(8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8), MovementTime_102 = c(1940.625,
2200.234375, 1950.078125, 1623.59375, 2266.875, 2608.4375,
1649.21875, 1690.390625, 3128.660714, 2018.75, 1701.40625,
2505.703125), MovementTime_104 = c(1601.875, 1658.046875,
1573.839286, 1435.15625, 2013.359375, 2302.109375, 1390.859375,
1616.71875, 2399.765625, 1410.625, 1336.40625, 1684.53125
), Pathlength_102 = c(2.8680385, 3.872267719, 2.808966672,
3.184808844, 3.450548063, 2.779296859, 3.057751688, 2.823023969,
3.831920395, 2.991207031, 2.790851078, 3.276254563), Pathlength_104 = c(2.65516175,
2.945664516, 2.568061634, 3.017285625, 3.408170609, 2.625024781,
2.655326156, 2.628399641, 2.975724094, 2.636576609, 2.661606391,
2.782565766), NormalizedJerk_102 = c(2060.157118, 2981.812369,
2089.925187, 1391.973644, 3900.411917, 4015.516784, 1411.201689,
1853.413926, 6830.819063, 2310.589311, 1340.465366, 5617.967587
), NormalizedJerk_104 = c(1092.701687, 1508.285476, 1269.670456,
914.3836443, 2335.718672, 2563.167235, 847.952528, 1394.847247,
3915.019566, 1023.170254, 765.2752941, 1705.629422), AveResultantVel_102 = c(2.021215719,
1.994460031, 1.789839578, 2.449869109, 2.037483406, 1.198650234,
2.374258766, 2.162818172, 1.467132962, 2.101220406, 1.983419094,
1.595565484), AveResultantVel_104 = c(2.317185313, 2.193130625,
2.113643324, 2.822947859, 2.213037, 1.311399453, 2.39646225,
2.113288797, 1.481807047, 2.644351188, 2.54589975, 2.014750766
), EndpointError_102 = c(1.62285542, 2.05362611, 2.27036917,
1.57970041, 1.83768956, 2.14219202, 1.374642, 2.03515938,
2.58900025, 2.28107478, 1.64171472, 2.13489883), EndpointError_104 = c(0.979220453,
1.477764016, 1.621229031, 1.239002656, 1.404618047, 1.796644641,
1.01018125, 1.593606016, 1.672676594, 1.483629813, 1.503123406,
1.370374047)), class = c("spec_tbl_df", "tbl_df", "tbl",
"data.frame"), row.names = c(NA, -12L), spec = structure(list(
cols = list(GROUP = structure(list(), class = c("collector_character",
"collector")), conditon2 = structure(list(), class = c("collector_character",
"collector")), Trial_type = structure(list(), class = c("collector_character",
"collector")), Training = structure(list(), class = c("collector_character",
"collector")), N = structure(list(), class = c("collector_double",
"collector")), MovementTime_102 = structure(list(), class = c("collector_double",
"collector")), MovementTime_104 = structure(list(), class = c("collector_double",
"collector")), Pathlength_102 = structure(list(), class = c("collector_double",
"collector")), Pathlength_104 = structure(list(), class = c("collector_double",
"collector")), NormalizedJerk_102 = structure(list(), class = c("collector_double",
"collector")), NormalizedJerk_104 = structure(list(), class = c("collector_double",
"collector")), AveResultantVel_102 = structure(list(), class = c("collector_double",
"collector")), AveResultantVel_104 = structure(list(), class = c("collector_double",
"collector")), EndpointError_102 = structure(list(), class = c("collector_double",
"collector")), EndpointError_104 = structure(list(), class = c("collector_double",
"collector"))), default = structure(list(), class = c("collector_guess",
"collector")), skip = 1), class = "col_spec"))
ggplot(data10, aes(y=conditon2, x=MovementTime_102, xend=MovementTime_104)) +
geom_dumbbell(size=3, color="#e3e2e1",
colour_x = "red", colour_xend = "blue",
dot_guide=TRUE, dot_guide_size=0.25) +
labs(x=NULL, y=NULL, title="Change in Movement time ms")
You've got duplicates for condition2
. You probably want to facet on the GROUP
variable.
ggplot(data10, aes(y=conditon2, x=MovementTime_102, xend=MovementTime_104)) +
geom_dumbbell(size=3, color="#e3e2e1",
colour_x = "red", colour_xend = "blue",
dot_guide=TRUE, dot_guide_size=0.25) +
labs(x=NULL, y=NULL, title="Change in Movement time ms") +
theme_minimal() +
facet_grid(~GROUP)
Required packages:
library(ggalt)
library(ggplot2)