1

I need some help with a graphic. I want to add the boxplot of the complete data. I've done it on the graph but got two colours on the box plot.

I also need help figuring out how to make the names of the data mechanisms easier to read. For example, increase the width of the ten rectangles.

The code of the plot:

tp <- bwplot(r2~y2|typ, data=d,
         horizontal=TRUE, layout=c(1,10),
         xlab=expression(Y[2]),
         col=c(mdc(2),mdc(1),mdc(3)),strip=FALSE, xlim=c(0,10),
         par.strip.text = list(cex=0.5),
         par.settings = list(layout.heights=list(strip=5)),
         scales = list(y = list(cex = 0.8)),
         strip.left = strip.custom(bg="grey95"))

Here is the dataframe d:

d <- 
structure(list(y1 = c(4.50461095759073, 5.91136212424366, 6.2341726607176, 
4.31517001243106, 4.03468424501696, 4.50461095759073, 5.91136212424366, 
6.2341726607176, 4.31517001243106, 4.03468424501696, 4.50461095759073, 
5.91136212424366, 6.2341726607176, 4.31517001243106, 4.03468424501696, 
4.50461095759073, 5.91136212424366, 6.2341726607176, 4.31517001243106, 
4.03468424501696, 4.50461095759073, 5.91136212424366, 6.2341726607176, 
4.31517001243106, 4.03468424501696, 4.50461095759073, 5.91136212424366, 
6.2341726607176, 4.31517001243106, 4.03468424501696, 4.50461095759073, 
5.91136212424366, 6.2341726607176, 4.31517001243106, 4.03468424501696, 
4.50461095759073, 5.91136212424366, 6.2341726607176, 4.31517001243106, 
4.03468424501696, 4.50461095759073, 5.91136212424366, 6.2341726607176, 
4.31517001243106, 4.03468424501696, 4.50461095759073, 5.91136212424366, 
6.2341726607176, 4.31517001243106, 4.03468424501696, 4.50461095759073, 
5.91136212424366, 6.2341726607176, 4.31517001243106, 4.03468424501696
), y2 = c(4.01008089738578, 4.81674644303593, 5.93752409664717, 
4.09807878631992, 6.13756977661119, 4.01008089738578, 4.81674644303593, 
5.93752409664717, 4.09807878631992, 6.13756977661119, 4.01008089738578, 
4.81674644303593, 5.93752409664717, 4.09807878631992, 6.13756977661119, 
4.01008089738578, 4.81674644303593, 5.93752409664717, 4.09807878631992, 
6.13756977661119, 4.01008089738578, 4.81674644303593, 5.93752409664717, 
4.09807878631992, 6.13756977661119, 4.01008089738578, 4.81674644303593, 
5.93752409664717, 4.09807878631992, 6.13756977661119, 4.01008089738578, 
4.81674644303593, 5.93752409664717, 4.09807878631992, 6.13756977661119, 
4.01008089738578, 4.81674644303593, 5.93752409664717, 4.09807878631992, 
6.13756977661119, 4.01008089738578, 4.81674644303593, 5.93752409664717, 
4.09807878631992, 6.13756977661119, 4.01008089738578, 4.81674644303593, 
5.93752409664717, 4.09807878631992, 6.13756977661119, 4.01008089738578, 
4.81674644303593, 5.93752409664717, 4.09807878631992, 6.13756977661119
), r2 = structure(c(2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 
2L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 
2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 
2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), levels = c("Ymis", 
"Yobs"), class = "factor"), typ = c("MARLEFT", "MARLEFT", "MARLEFT", 
"MARLEFT", "MARLEFT", "MARMID", "MARMID", "MARMID", "MARMID", 
"MARMID", "MARRIGHT", "MARRIGHT", "MARRIGHT", "MARRIGHT", "MARRIGHT", 
"MARTAIL", "MARTAIL", "MARTAIL", "MARTAIL", "MARTAIL", "MCAR", 
"MCAR", "MCAR", "MCAR", "MCAR", "MNARLEFT", "MNARLEFT", "MNARLEFT", 
"MNARLEFT", "MNARLEFT", "MNARMID", "MNARMID", "MNARMID", "MNARMID", 
"MNARMID", "MNARRIGHT", "MNARRIGHT", "MNARRIGHT", "MNARRIGHT", 
"MNARRIGHT", "MNARTAIL", "MNARTAIL", "MNARTAIL", "MNARTAIL", 
"MNARTAIL", "Full", "Full", "Full", "Full", "Full", "Full", "Full", 
"Full", "Full", "Full")), row.names = c(NA, -55L), class = "data.frame")
user20650
  • 24,654
  • 5
  • 56
  • 91
Ibrahima
  • 11
  • 3
  • Please provide a minimal reproducible example - include what code you have tried, some data using `dput()`, and the output you expect to get. It makes it much easier for others to help if we can run your code! – nrennie May 28 '23 at 23:20

0 Answers0