yarrr icon indicating copy to clipboard operation
yarrr copied to clipboard

2 issues: order of panels when 3 independant variables in the formula and size of panels

Open cnnmat opened this issue 6 years ago • 0 comments

Hi @ndphillips !

First of all, thanks for the great library!

At the moment, I can't find a way around these issues:

  • Problem 1:

When having 3 independent variables in the formula, the order in which the panels/facets appear in the plot are the alphabetical one and it does not seem changeable Example: The 3rd group has the order A,C,B but it appears in the order A,B,C in the plot

data_pirate1<-data_frame(
        ys=sample(1:100, 240, replace=T),
        group1=c(rep("X1",length(ys)/3/5),rep("X2",length(ys)/3/5),rep("X3",length(ys)/3/5),rep("X4",length(ys)/3/5),rep("X5",length(ys)/3/5),rep("X6",length(ys)/3/4),rep("X7",length(ys)/3/4),rep("X8",length(ys)/3/4),rep("X9",length(ys)/3/4),rep("X10",length(ys)/3/4),rep("X11",length(ys)/3/4),rep("X12",length(ys)/3/4),rep("X13",length(ys)/3/4)),
        group2=rep(c("R1","R2"),length(ys)/2),
        group3=c(rep("A",length(ys)/3),rep("C",length(ys)/3),rep("B",length(ys)/3))
)


pirateplot(formula = ys ~ group2+group1+group3,
         data = data_pirate1,
         sortx="sequential"
)
  • Problem 2:

When having 2 or more panels, all the panels have the size (x wise) of the first one. That result in some data not appearing on the plot.

Here 'X7' appears:

data_pirate2<-data_frame(
          ys=sample(1:100, 120, replace=T),
          group1=c(rep("X1",length(ys)/2/4),rep("X2",length(ys)/2/4),rep("X3",length(ys)/2/4),rep("X4",length(ys)/2/4),rep("X5",length(ys)/2/3),rep("X6",length(ys)/2/3),rep("X7",length(ys)/2/3)),
          group2=rep(c("R1","R2"),length(ys)/2),
          group3=c(rep("A",length(ys)/2),rep("B",length(ys)/2))
)
pirateplot(formula = ys ~ group2+group1+group3,
           data = data_pirate2,
)

Here 'X7' doesn't appear anymore:

data_pirate3<-data_frame(
          ys=sample(1:100, 120, replace=T),
          group1=c(rep("X1",length(ys)/2/3),rep("X2",length(ys)/2/3),rep("X3",length(ys)/2/3),rep("X4",length(ys)/2/4),rep("X5",length(ys)/2/4),rep("X6",length(ys)/2/4),rep("X7",length(ys)/2/4)),
          group2=rep(c("R1","R2"),length(ys)/2),
          group3=c(rep("A",length(ys)/2),rep("B",length(ys)/2))
)
pirateplot(formula = ys ~ group2+group1+group3,
           data = data_pirate3,
)

Also, I was wondering if there was a way to remove the "group3 =" appearing in the label?

cnnmat avatar Jun 13 '18 17:06 cnnmat