I've got this dataframe
df <- structure(list(rang = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25.5, 25.5, 27.5,
27.5, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42.5,
42.5, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54.5, 54.5, 56,
57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88
), dr = c(164, 176, 260, 297, 308, 313, 327, 333, 339, 365, 396,
403, 404, 410, 413, 414, 422, 424, 440, 442, 443, 451, 477, 496,
530, 530, 546, 546, 548, 565, 567, 574, 576, 587, 590, 603, 619,
626, 629, 630, 642, 653, 653, 660, 667, 670, 677, 682, 689, 711,
716, 737, 763, 772, 772, 776, 778, 792, 794, 820, 835, 838, 842,
855, 861, 888, 890, 899, 906, 908, 969, 1011, 1046, 1058, 1069,
1072, 1074, 1100, 1153, 1348, 1368, 1432, 1468, 1516, 1612, 1712,
1714, 1731), signe = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 2L,
1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L,
1L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L,
2L), .Label = c("negatif", "positif"), class = "factor")), .Names = c("rang",
"dr", "signe"), row.names = c(NA, -88L), class = "data.frame")
and this chart when I use the stripchart
function in base R
stripchart(df[,1]~df[,3],
method="stack", vertical=FALSE, ylim=c(0.5,2.5),
group.names=levels(df[,3]),
xlab="Rang des différences dr", pch=18, cex=1.2)
Can I have the same plot with the library ggplot2
?
I used geom_dotplot
but I didn't the same plot. This an example
ggplot(data = df, aes(y=df[,1], x=factor(df[,3]))) +
geom_dotplot(binaxis = "y", dotsize = 0.5) +
coord_cartesian(ylim=c(0, 88)) +
scale_y_continuous(breaks=seq(0, 88, 1))
Help me, please!