rvlenth / emmeans

Estimated marginal means
https://rvlenth.github.io/emmeans/
364 stars 32 forks source link

pwpp x-axis adjustment: help needed #421

Closed davidsimondavis closed 1 year ago

davidsimondavis commented 1 year ago

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

rvlenth commented 1 year ago

Can you give me data/code by which I can reproduce this behavior?

rvlenth commented 1 year ago

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.

rvlenth commented 1 year ago

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

davidsimondavis commented 1 year ago

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

rvlenth commented 1 year ago

I think this is resolved, so am closing this issue