我想将我的X轴表示为Y的三个不同值

时间:2018-09-18 00:45:43

标签: r ggplot2

我想在这里将我的X轴表示为每个相应箱形图的三个不同的Y值(0,1,2)。我知道这与使Y为

有关
        library(ggplot2)
        library(readr)
        library(dplyr)

boxyplot <- HW1a %>% 
  as.factor(Y) %>% 
    group_by(Y)


ggplot(data = boxyplot, mapping = aes(group = Y, x = Y, y = X)) +
  geom_boxplot(color = "black", fill = "steelblue") +
  ylab("Values of X") +
  ggtitle("Boxplots of X Given Y")

不确定具体是我做错了什么,但我敢肯定这很容易解决!

这是一些示例代码,大数据文件,所以我只剪了一大堆,但它是连续的X以及明确的Y和Z:

structure(list(X = c(29L, 22L, 27L, 26L, 25L, 26L, 16L, 30L, 
31L, 32L, 29L, 19L, 18L, 26L, 25L, 22L, 23L, 27L, 21L, 16L, 18L, 
25L, 21L, 23L, 22L, 25L, 29L, 23L, 20L, 25L, 25L, 21L, 30L, 27L, 
25L, 18L, 27L, 25L, 27L, 28L, 26L, 20L, 20L, 20L, 23L, 33L, 27L, 
17L, 21L, 19L, 26L, 26L, 20L, 25L, 30L, 17L, 31L, 26L, 25L, 20L, 
27L, 21L, 21L, 21L, 26L, 30L, 23L, 22L, 28L, 17L, 22L, 16L, 25L, 
19L, 14L, 19L, 29L, 27L, 21L, 31L, 24L, 20L, 14L, 23L, 21L, 26L, 
29L, 24L, 27L, 17L, 21L, 19L, 21L, 22L, 22L, 26L, 26L, 34L, 28L, 
34L, 26L, 23L, 24L, 25L, 21L, 19L, 18L, 19L, 20L, 22L, 21L, 20L, 
22L, 19L, 22L, 27L, 25L, 20L, 23L, 19L, 32L, 25L, 27L, 23L, 30L, 
31L, 31L, 23L, 25L, 21L, 26L, 17L, 24L, 16L, 29L, 20L, 31L, 28L, 
28L, 26L, 26L, 29L, 33L, 23L, 19L, 24L, 23L, 20L, 20L, 28L, 19L, 
26L, 25L, 24L, 19L, 21L, 22L, 21L, 31L, 21L, 16L, 23L, 29L, 25L, 
24L, 19L, 19L, 19L, 23L, 25L, 26L, 19L, 22L, 24L, 29L, 19L, 15L, 
22L, 17L, 23L, 27L, 23L, 16L, 23L, 28L, 21L, 30L, 19L, 24L, 23L, 
24L, 31L, 23L, 28L, 21L, 25L, 29L, 22L, 28L, 20L, 20L, 28L, 29L, 
27L, 27L, 22L, 22L, 29L, 31L, 22L, 24L, 15L, 20L, 34L, 23L, 24L, 
21L, 25L, 24L, 20L, 26L, 24L, 16L, 25L, 27L, 28L, 26L, 24L, 22L, 
21L, 27L, 25L, 24L, 26L, 16L, 29L, 18L, 26L, 23L, 26L, 27L, 16L, 
33L, 23L, 31L, 23L, 21L, 22L, 22L, 20L, 19L, 24L, 25L, 28L, 24L, 
26L, 30L, 26L, 29L, 17L, 29L, 19L, 28L, 25L, 24L, 23L, 25L, 19L, 
25L, 24L, 23L, 20L, 18L, 20L, 21L, 20L, 24L, 32L, 19L, 19L, 22L, 
21L, 22L, 22L, 20L, 25L, 17L, 28L, 25L, 22L, 19L, 24L, 15L, 26L, 
26L, 30L, 29L, 20L, 26L, 25L, 27L, 24L, 26L, 21L, 23L, 22L, 13L, 
21L, 22L, 25L, 23L, 23L, 15L, 20L, 29L, 26L, 23L, 23L, 20L, 23L, 
21L, 30L, 16L, 21L, 19L, 20L, 26L, 30L, 20L, 20L, 23L, 22L, 24L, 
19L, 21L, 24L, 19L, 26L, 32L, 20L, 19L, 24L, 20L, 29L, 21L, 20L, 
26L, 22L, 22L, 23L, 27L, 24L, 24L, 25L, 21L, 30L, 21L, 23L, 27L, 
21L, 27L, 23L, 24L, 22L, 20L, 18L, 30L, 20L, 23L, 21L, 24L, 28L, 
22L, 17L, 21L, 26L, 22L, 24L, 25L, 27L, 24L, 21L, 19L, 24L, 18L, 
29L, 21L, 23L, 19L, 16L, 21L, 24L, 19L, 24L, 26L, 27L, 22L, 17L, 
16L, 25L, 21L, 19L, 27L, 33L, 24L, 26L, 26L, 27L, 23L, 24L, 24L, 
24L, 20L, 23L, 21L, 19L, 23L, 32L, 17L, 16L, 16L, 25L, 23L, 21L, 
22L, 25L, 19L, 23L, 24L, 18L, 26L, 24L, 21L, 20L, 27L, 23L, 22L, 
28L, 20L, 21L, 20L, 22L, 19L, 27L, 22L, 21L, 24L, 18L, 24L, 21L, 
17L, 22L, 24L, 18L, 19L, 21L, 27L, 28L, 23L, 17L, 28L, 20L, 23L, 
22L, 21L, 20L, 30L, 30L, 23L, 24L, 25L, 23L, 24L, 29L, 17L, 22L, 
28L, 14L, 23L, 21L, 23L, 21L, 20L, 25L, 26L, 24L, 23L, 22L, 21L, 
26L, 30L, 19L, 22L, 22L, 19L, 19L, 26L, 24L, 22L, 20L, 22L, 27L, 
19L, 27L, 18L, 20L, 19L, 22L, 30L, 14L, 23L, 27L, 23L, 16L, 20L, 
20L, 20L, 25L, 19L, 21L, 21L, 23L, 18L, 24L, 22L, 26L, 22L, 17L, 
21L, 21L, 22L, 19L, 21L, 27L, 23L, 20L, 28L, 26L, 26L, 24L, 20L, 
30L, 27L, 21L, 25L, 20L, 25L, 25L, 24L, 19L, 25L, 25L, 19L, 22L, 
26L, 16L, 28L, 21L, 23L, 25L, 26L, 14L, 24L, 25L, 19L, 26L, 27L, 
19L, 20L, 23L, 23L, 28L, 19L, 20L, 23L, 27L, 24L, 25L, 23L, 24L, 
25L, 21L, 28L, 20L, 26L, 29L, 24L, 18L, 20L, 22L, 32L, 35L, 25L, 
21L, 24L, 13L, 17L, 21L, 28L, 25L, 19L, 22L, 27L, 28L, 26L, 19L, 
27L, 20L, 22L, 24L, 24L, 31L, 23L, 29L, 28L, 20L, 19L, 28L, 23L, 
21L, 25L, 21L, 22L, 27L, 25L, 21L, 23L, 25L, 26L, 27L, 26L, 25L, 
29L, 33L, 25L, 21L, 19L, 23L, 19L, 19L, 31L, 21L, 23L, 22L, 28L, 
27L, 21L, 22L, 19L, 25L, 26L, 24L, 15L, 21L, 32L, 27L, 27L, 25L, 
23L, 28L, 23L, 21L, 27L, 16L, 17L, 23L, 29L, 22L, 21L, 30L, 26L, 
20L, 21L, 27L, 19L, 29L, 22L, 26L, 19L, 21L, 28L, 29L, 22L, 17L, 
30L, 26L, 25L, 20L, 20L, 24L, 28L, 25L, 19L, 26L, 20L, 25L, 18L, 
17L, 26L, 27L, 28L, 22L, 18L, 23L, 29L, 26L, 27L, 33L, 20L, 23L, 
20L, 16L, 23L, 30L, 25L, 27L, 26L, 26L, 22L, 26L, 20L, 24L, 22L, 
25L, 23L, 28L, 24L, 21L, 22L, 27L, 24L, 27L, 21L, 30L, 33L, 13L, 
26L, 20L, 24L, 20L, 22L, 21L, 21L, 32L, 19L, 31L, 28L, 21L, 26L, 
19L, 23L, 22L, 23L, 22L, 21L, 24L, 16L, 25L, 20L, 27L, 21L, 24L, 
24L, 27L, 22L, 25L, 28L, 27L, 28L, 28L, 18L, 16L, 23L, 22L, 24L, 
23L, 23L, 29L, 23L, 18L, 22L, 24L, 27L, 28L, 23L, 22L, 15L, 27L, 
23L, 24L, 17L, 31L, 24L, 17L, 16L, 28L, 27L, 27L, 23L, 23L, 30L, 
21L, 24L, 16L, 25L, 16L, 23L, 27L, 20L, 23L, 19L, 25L, 18L, 22L, 
24L, 19L, 22L, 27L, 22L, 18L, 13L, 19L, 26L, 23L, 25L, 29L, 17L, 
24L, 30L, 18L, 27L, 16L, 22L, 29L, 16L, 19L, 21L, 21L, 22L, 21L, 
17L, 19L, 20L, 31L, 30L, 25L, 25L, 23L, 21L, 26L, 20L, 22L, 20L, 
21L, 25L, 22L, 21L, 24L, 13L, 24L, 24L, 23L, 24L, 23L, 19L, 27L, 
22L, 37L, 22L, 25L, 23L, 27L, 14L, 26L, 21L, 19L, 21L, 22L, 29L, 
26L, 23L, 21L, 20L, 14L, 23L, 26L, 21L, 26L, 17L, 21L, 19L, 23L, 
14L, 25L, 18L, 22L, 28L, 29L, 21L, 27L, 25L, 28L, 24L, 24L, 24L, 
30L, 22L, 24L, 21L, 24L, 16L, 25L, 18L, 20L, 19L, 25L, 17L, 20L, 
21L, 18L, 19L, 26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2L, 2L, 1L, 2L, 0L, 1L, 2L, 2L, 1L, 
    1L, 0L, 1L, 0L, 2L, 1L, 1L, 2L, 0L, 1L, 2L, 1L, 2L, 1L, 2L, 
    2L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 0L, 
    0L, 2L, 1L, 1L, 0L, 0L, 0L, 2L, 0L, 2L, 1L, 2L, 1L, 1L, 1L, 
    1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 0L, 1L, 1L, 2L, 1L, 2L, 
    2L, 1L, 1L, 0L, 2L, 0L, 1L, 1L, 1L, 2L, 1L, 2L)), class = "data.frame", row.names = c(NA, 
-1000L), spec = structure(list(cols = list(X = structure(list(), class = c("collector_integer", 
"collector")), Y = structure(list(), class = c("collector_integer", 
"collector")), Z = structure(list(), class = c("collector_integer", 
"collector"))), default = structure(list(), class = c("collector_guess", 
"collector"))), class = "col_spec"))

1 个答案:

答案 0 :(得分:0)

这是你的追求吗?

ggplot(data = boxyplot, mapping = aes(x = as.factor(Y), y = X)) +
    geom_boxplot(color = "black", fill = "steelblue") +
    labs(x = "Value of Y", y = "Values of X") +
    ggtitle("Boxplots of X Given Y")

enter image description here