Search code examples
rboxplotggboxplot

Multiple BoxPlot


I want to plot a boxplot. I really did some research before raise a question at here. At first I tried in Excel but it caused laggy due to the data is so large. So, I decided to R.

My data consist of 180 of 100x2 data frame. So, it has 180000 rows.

Means, I have 100's of A, 100's of B, and so so.

How can I plot a boxplot that have A, B, C,... so on together in R?

enter image description here

My desired outcome (but want to have D..E..F..together)

enter image description here

How can I do that in R? Need help...


Solution

  • I agree with the comments. you can easily find this by searching, unless I am misunderstanding what you want. Also, please provide you code or data. Below, I created random data to show the skeleton of what you would do for a clustered boxplot.

    letters <- c('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J')
    
    data <- data.frame(Type = sample(letters, 200, replace = TRUE),
                       Delta = runif(200, min = -0.05, max = 0.2))
    
    ggplot(data, aes(x = Type, y = Delta, fill = Type)) +
      geom_boxplot() +
      labs(title = "Type vs. Delta",
           x = "Type", y = "Delta") +
      theme_minimal()
    
    

    Clustered Boxplot