0

I cannot put the boxplots on their right place on a graph. How can I do that?

I have a data table. I plotted each row of it verses 10 confidence levels. Then I need to make Boxplots for each column and place them on the same range of confidence levels.

## I plotted my data rows verses confidence levels with a loop 

for (i in 1:50){
  QRFcs <- c(99, 97.5, 95, 90, 80, 60, 40, 20, 10, 5) # confidence level
  plot(QRFcs, data_sum[i,], xlab=" Confidence Level", 
       ylab= "Prediction Interval Covrage Probability (PICP)",
       cex.main = 2, main =" Soil Thickness: QRF", ylim=c(0,100))
  par(new=TRUE)
}
par(new=TRUE)
## Then I tried to boxplot the data columns on the same graph 
boxplot(data_sum$X10, data_sum$X9, 
        data_sum$X8, data_sum$X7, data_sum$X6, 
        data_sum$X5, data_sum$X4, data_sum$X3, data_sum$X2, data_sum$X1, 
        axes = TRUE, boxlwd = 2, outwex = 5, boxwex = 0.1)

## But I cannot put the boxplots on the right place

it is a plot of table rows vs confidence levels and column boxplots

BabakK
  • 47
  • 3
  • Can you bring the structure of your data using `dput`? – Rodrigo Orellana Aug 27 '19 at 04:23
  • 2
    You cannot call `boxplot` with 10 variables. Reformat from [wide to long](https://stackoverflow.com/questions/2185252/reshaping-data-frame-from-wide-to-long-format) and `boxplot(value ~ variable, long_df)` or something similar. – Rui Barradas Aug 27 '19 at 05:13
  • I can use boxplot with 10 variables. to put them on the right place I should add one parameter: at = c( 99, ..., 5) – BabakK Aug 27 '19 at 20:53

0 Answers0