0

I have this code in R:

xyplot(remove_SMO ~ A, groups = C,
   type="a",
   ylab="Remoção de óleo (%)",
   xlab = "pH",
   auto.key = list(space = "right", points = FALSE, lines = TRUE))

enter image description here

And this similar one:

xyplot(remove_SMO ~ B, groups = E,
   type="a",
   ylab="Remoção de óleo (%)",
   xlab = "Temperatura",
   auto.key = list(space = "right", points = FALSE, lines = TRUE))

enter image description here

How could I do something like this using lattice, grouping these two interaction graphs?

enter image description here *The order of the graphics does not matter.

And what good material to learn how to edit graphs developed in lattice? Note that the split command for multiples plots helps but is not ideal, and there is difference in the positioning of the legend for the pink and blue lines. The "facet_wrap" with | is also different, as it greatly changes the aesthetics.

My code for the example.

if(!require("FrF2")) install.packages("FrF2") ; library(FrF2)
if(!require("lattice")) install.packages("lattice") ; library(lattice)

plan.person = FrF2(nfactors = 5,
               resolution = 5,
               replications = 2,
               randomize = FALSE,
               factor.names = list(
                 A = c(3, 9),
                 B = c(5, 30),
                 C = c(0.05, 0.5),
                 D = c(50, 350),
                 E = c(100, 200)
               ))

remove_SMO <- c(94.80, 23.40, 99.60, 38.00, 80.20, 27.00, 96.40, 60.00, 99.90, 9.10,
       98.40, 37.10, 99.77, 51.70, 97.40, 58.00, 95.10, 25.00, 99.50, 39.10,
       80.60, 28.00, 96.70, 61.20, 99.70, 10.00, 98.80, 37.40, 99.40, 52.00,
       97.70, 58.40)

plan.atualizado1 = add.response(design = plan.person, response = remove_SMO)

attach(plan.atualizado1)
bbiasi
  • 1,549
  • 2
  • 15
  • 31
  • See that it has the values of y and x (letters), but here I have a new variable. Here I have three variables. – bbiasi Jun 03 '18 at 03:19
  • The solution provided in the link has 3 variables, too, where the third variable is used as `facet` or `group`. – hpesoj626 Jun 03 '18 at 03:24
  • @hpesoj626, i edited, note that only my Y axis is not varying, and I have two plots with four different factors. – bbiasi Jun 03 '18 at 03:25
  • As to how to get started with `lattice`, see the package's vignette. http://lattice.r-forge.r-project.org/Vignettes/src/lattice-intro/lattice-intro.pdf – hpesoj626 Jun 03 '18 at 03:26
  • Can you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? Start with a minimal sample of your data set. If your data set, say `df` is not that large, paste the output of `dput(df)` into your question. – hpesoj626 Jun 03 '18 at 03:29
  • I edited again, I inserted a part of my code. – bbiasi Jun 03 '18 at 03:37
  • See solutions here: https://stackoverflow.com/questions/2540129/lattice-multiple-plots-in-one-window – hpesoj626 Jun 03 '18 at 04:05
  • Thanks for the tip! – bbiasi Jun 03 '18 at 04:15

0 Answers0