Hi all,
I would like to ask you for help. I did a dotplot - using dotchart
function.
There are two localites (loc) with values 75 or 56 in my data ZZ.
The f column has 4 levels: P1, S1, S8, R6.
The dataframe is ordered by N value, pchloc value is assign to use
"pch" in
plot.
> head(ZZ)
loc f N color ordered pchloc
98 75 S1 6.39 green 1 16
99 75 S8 6.44 blue 2 16
71 75 S8 6.60 blue 3 16
100 75 R6 6.64 black 4 16
70 75 S1 6.81 green 5 16
51 75 S8 6.83 blue 6 16
> dput(ZZ)
structure(list(loc = c(75L, 75L, 75L, 75L, 75L, 75L, 75L, 75L,
56L, 56L, 75L, 75L, 75L, 75L, 75L, 75L, 75L, 56L, 75L, 75L, 56L,
56L, 75L, 75L, 75L, 56L, 75L, 56L, 56L, 75L, 75L, 75L, 75L, 75L,
75L, 56L, 56L, 75L, 75L, 75L, 75L, 56L, 75L, 75L, 75L, 75L, 56L,
56L, 56L, 56L, 75L, 75L, 75L, 75L, 75L, 75L, 75L, 56L, 75L, 56L,
75L, 75L, 75L, 75L, 75L, 56L, 75L, 75L, 75L, 75L, 56L, 75L, 75L,
56L, 75L, 56L, 75L, 75L, 56L, 56L, 75L, 75L, 75L, 75L, 75L, 75L,
56L, 75L, 56L, 75L, 75L, 75L, 75L, 75L, 56L, 75L, 56L, 75L, 56L,
75L, 75L, 75L, 75L, 75L, 75L, 75L, 56L, 75L, 75L, 75L, 75L, 75L,
56L, 75L, 56L, 56L, 56L, 75L, 75L, 56L, 75L, 56L, 75L, 56L, 56L,
56L, 56L, 56L), f = structure(c(2L, 3L, 3L, 4L, 2L, 3L, 4L, 3L,
2L, 3L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 2L, 4L, 3L, 1L, 3L, 1L, 3L,
3L, 4L, 3L, 2L, 4L, 4L, 3L, 2L, 2L, 4L, 2L, 3L, 4L, 2L, 3L, 3L,
3L, 4L, 4L, 2L, 3L, 3L, 3L, 2L, 3L, 2L, 3L, 1L, 3L, 4L, 2L, 2L,
2L, 3L, 2L, 2L, 3L, 4L, 2L, 2L, 4L, 1L, 4L, 1L, 2L, 2L, 3L, 1L,
4L, 2L, 3L, 2L, 3L, 1L, 3L, 4L, 1L, 3L, 1L, 4L, 1L, 1L, 1L, 2L,
1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 4L,
4L, 4L, 1L, 4L, 4L, 4L, 4L, 1L, 4L, 4L, 1L, 4L, 2L, 1L, 4L, 3L,
4L, 4L, 1L, 4L, 1L, 4L, 1L, 1L), .Label = c("P1", "S1",
"S8",
"R6"), class = "factor"), N = c(6.39, 6.44, 6.6, 6.64, 6.81,
6.83, 6.84, 6.91, 6.93, 6.93, 6.94, 6.95, 7.01, 7.04, 7.12, 7.16,
7.24, 7.26, 7.26, 7.27, 7.29, 7.34, 7.34, 7.34, 7.41, 7.42, 7.42,
7.43, 7.43, 7.43, 7.44, 7.44, 7.45, 7.47, 7.49, 7.51, 7.52, 7.53,
7.53, 7.54, 7.54, 7.55, 7.55, 7.57, 7.57, 7.58, 7.59, 7.61, 7.61,
7.65, 7.67, 7.68, 7.69, 7.69, 7.7, 7.72, 7.72, 7.73, 7.75, 7.76,
7.78, 7.78, 7.78, 7.8, 7.81, 7.86, 7.86, 7.88, 7.92, 7.94, 7.95,
7.95, 7.98, 8, 8, 8.01, 8.02, 8.04, 8.11, 8.16, 8.17, 8.22, 8.23,
8.23, 8.26, 8.27, 8.31, 8.35, 8.37, 8.37, 8.41, 8.44, 8.45, 8.47,
8.49, 8.52, 8.55, 8.59, 8.62, 8.71, 8.71, 8.72, 8.78, 8.85, 8.91,
8.95, 9.02, 9.07, 9.07, 9.1, 9.12, 9.17, 9.19, 9.34, 9.36, 9.46,
9.46, 9.52, 9.63, 9.82, 10.01, 10.33, 10.33, 10.49, 10.88, 11.01,
11.24, 12.6), color = c("green", "blue", "blue",
"black", "green",
"blue", "black", "blue", "green",
"blue", "green", "green", "green",
"green", "blue", "green", "blue",
"green", "black", "blue", "red",
"blue", "red", "blue", "blue",
"black", "blue", "green", "black",
"black", "blue", "green", "green",
"black", "green", "blue",
"black", "green", "blue", "blue",
"blue", "black", "black", "green",
"blue", "blue", "blue", "green",
"blue", "green", "blue", "red",
"blue", "black", "green", "green",
"green", "blue", "green",
"green", "blue", "black", "green",
"green", "black", "red", "black",
"red", "green", "green", "blue",
"red", "black", "green", "blue",
"green", "blue", "red", "blue",
"black", "red", "blue", "red",
"black", "red", "red", "red",
"green", "red", "red", "green",
"red", "red", "red", "green",
"red", "blue", "red", "red",
"red",
"red", "red", "red", "black",
"black", "black", "red", "black",
"black", "black", "black", "red",
"black", "black", "red", "black",
"green", "red", "black", "blue",
"black", "black", "red", "black",
"red", "black", "red", "red"), ordered =
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, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 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, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128), pchloc = c(16, 16, 16, 16, 16, 16, 16, 16, 1, 1, 16, 16,
16, 16, 16, 16, 16, 1, 16, 16, 1, 1, 16, 16, 16, 1, 16, 1, 1,
16, 16, 16, 16, 16, 16, 1, 1, 16, 16, 16, 16, 1, 16, 16, 16,
16, 1, 1, 1, 1, 16, 16, 16, 16, 16, 16, 16, 1, 16, 1, 16, 16,
16, 16, 16, 1, 16, 16, 16, 16, 1, 16, 16, 1, 16, 1, 16, 16, 1,
1, 16, 16, 16, 16, 16, 16, 1, 16, 1, 16, 16, 16, 16, 16, 1, 16,
1, 16, 1, 16, 16, 16, 16, 16, 16, 16, 1, 16, 16, 16, 16, 16,
1, 16, 1, 1, 1, 16, 16, 1, 16, 1, 16, 1, 1, 1, 1, 1)), .Names =
c("loc",
"f", "N", "color", "ordered",
"pchloc"), row.names = c(98L, 99L,
71L, 100L, 70L, 51L, 68L, 83L, 34L, 35L, 82L, 50L, 42L, 46L,
63L, 62L, 43L, 6L, 44L, 87L, 5L, 31L, 61L, 79L, 55L, 36L, 67L,
2L, 32L, 108L, 47L, 66L, 86L, 88L, 122L, 11L, 16L, 94L, 95L,
115L, 123L, 24L, 80L, 78L, 111L, 103L, 3L, 22L, 23L, 10L, 107L,
97L, 75L, 96L, 106L, 102L, 118L, 7L, 110L, 30L, 59L, 76L, 114L,
74L, 104L, 1L, 64L, 73L, 54L, 58L, 19L, 69L, 92L, 14L, 119L,
18L, 127L, 41L, 15L, 8L, 49L, 91L, 65L, 120L, 113L, 93L, 17L,
126L, 29L, 105L, 90L, 77L, 81L, 45L, 38L, 85L, 39L, 53L, 9L,
121L, 125L, 109L, 101L, 48L, 52L, 84L, 21L, 60L, 72L, 56L, 124L,
57L, 12L, 112L, 13L, 4L, 26L, 89L, 116L, 27L, 128L, 20L, 117L,
40L, 33L, 28L, 37L, 25L), class = "data.frame")
I use this codes (I made them more simple for this post)
# per groups (P1, S1, S8, R6)
dotchart(ZZ$N, cex=.7, groups= ZZ$f,
xlab= "N",
xlim = c(6, 13),
ylab= "f",
gcolor= "black", color=ZZ$color,
pch=ZZ$pchloc) # to distinguish between localites
# without groups
dotchart(ZZ$N, cex=.7,
xlab= "N",
xlim = c(6, 13),
ylab= "f",
gcolor= "black", color=ZZ$color,
pch=ZZ$pchloc) # to distinguish between localites
In theory, the dots should be filled/empty on the same values in both plots.
The problem occurs in assigning the "pch"value in the first plot (per
groups).
If you run the code you can see that there are differencies in the pch of
dots within this two dotplots.
(for example the red P1 values - the dot at 10.33 should be filled, as it
is in the second plot ...)
I checked the values in dataframe and the second plot (without groups)
seems to use correct pch.
Does anybody know why this differences occur? Or am I just missing
something?
I work in R-studio, "R version 2.15.2 (2012-10-26)", on Mac,
"x86_64-apple-darwin9.8.0".
Thank you!
Zuzana
[[alternative HTML version deleted]]