rvlenth/emmeans

pwpp x-axis adjustment: help needed

davidsimondavis opened this issue · 5 comments

Explain your question

Screenshot 2023-05-09 at 9 50 28 am

hi, i've plotted pwpp for my emmeans+contrasts but the x-axes are so crowded to one side/squashed - how may I adjust this?

Ground rules

  • I really do expect you to look at the documentation and vignettes before
    sending questions.
  • Did you know that there is an index of vignette topics? That can be
    helpful for finding help on certain topics. See
    https://cran.r-project.org/web/packages/emmeans/vignettes/vignette-topics.html
  • More than one or two pipes is usually too many. I'd rather see the individual
    steps and the results thereof.
  • Please examine the output from what you have tried. Often there are a few
    lines of annotation below the output. If you wrap your results with
    as.data.frame() once or twice to suppress those annotations, I
    consider that willful ignorance, and will not help you.
  • Please do not create different objects having the same name;
    that causes confusion and makes it hard to refer to particular results.

The problem here is that there is no good way to allow the right amount of space for the value labels so that they fit correctly. It's an issue between the physical scaling necessary versus the nonlinear scaling of the x axis. This gets worse when the values comprise several digits and the plot is broken into panels. From the documentation for the values argument for pwpp():

values: Logical value. If TRUE, the values of the EMMs are included in the plot. When there are several side-by-side panels due to by variable(s), the labels showing values start stealing a lot of space from the plotting area; in those cases, it may be desirable to specify FALSE or use rows so that some panels are vertically stacked.

So I think the best resolution may simply be to specify values = FALSE, and supplement the plot with a tabular display of the EMMs.

PS -- you may also experiment with the add.space argument (giving a negative value, most likely).

these suggestions work brilliantly! i have awesome pwpp's now! thanks so much! really loving this package :)

I think this is resolved, so am closing this issue