seasons <- structure(list(values = c(204, 339, 304, 434, 334, 212, 361,
102, 298, 369, 149, 227, 278, 199, 360, 211, 219, 209, 177, 299,
262, 285, 237, 227, 216, 229, 317, 321, 327, 123, 84, 321, 442,
263, 225, 290, 259, 219, 244, 325, 257, 672, 762, 381, 698, 578,
576, 386, 834, 790, 815, 736, 517, 556, 685, 781, 703, 1071,
537, 784, 753, 790, 489, 878, 433, 742, 638, 731, 1017, 850,
804, 612, 923, 1000, 855, 750, 921, 676, 621, 781, 703, 1054,
156, 312, 267, 152, 352, 155, 215, 184, 186, 221, 352, 183, 307,
353, 507, 255, 159, 109, 343, 377, 209, 260, 193, 231, 111, 167,
233, 360, 488, 347, 208, 178, 371, 276, 263, 166, 486, 119, 153,
315, 226, 158, 142, 78, 75, 156, 53, 103, 141, 94, 94, 55, 84,
35, 82, 65, 150, 30, 201, 184, 94, 119, 150, 70, 63, 50, 74,
160, 49, 52, 135, 105, 129, 75, 83, 85, 84, 85, 77, 147, 100,
46), ind = 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, 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, 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, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("spring",
"summer", "autumn", "winter"), class = "factor", scores = structure(c(3,
1, 2, 4), .Dim = 4L, .Dimnames = list(c("autumn", "spring", "summer",
"winter"))))), .Names = c("values", "ind"), row.names = c(NA,
-164L), class = "data.frame")
我在下面做了一个箱线图和 bean 图。
boxplot(seasons$values~seasons$ind, ylim= c(0,1200))
beanplot(seasons$values~seasons$ind, ylim= c(0,1200),
col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", side="second")
我想同时制作一个包含这些箱线图和 bean 线图的图表。
这将使比较容易。泰国语是为什么我在两个情节中都使用相同的伊利姆。
有什么办法吗?
最佳答案
对于beanplot软件包,请使用add = TRUE:
boxplot(seasons$values~seasons$ind, ylim= c(0,1200))
beanplot(seasons$values~seasons$ind, ylim= c(0,1200), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", side="second", add=T)
关于r - 如何在同一张图表中制作beanplot和boxplot?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26214471/