dabestr icon indicating copy to clipboard operation
dabestr copied to clipboard

Controling Aesthetics in dabestr

Open coopert25 opened this issue 4 years ago • 2 comments

Great package so far, having troubles controlling some key aesthetics. I want to be able to control the y-axis title and move it closer to its y-axis. This can normally be achieved in ggplot using theme(axis.title.y = element_text(hjust=3.5)) Though if we try to add this line of code into the plotting of a Gardner Altman plot using Dabestr it doesn't work. Is there some way to control this aesthetic?

Below is an example using the iris dataset and the associated error if we try to alter the theme data(iris) iris <- dplyr::filter(iris, Species != "setosa") iris_plot <- dabest(iris, Species, Sepal.Length, idx = c("versicolor", "virginica"), paired= FALSE) plot(iris_plot, rawplot.ylabel = "Sepal Length (cm)", effsize.ylabel = "Mean difference", rawplot.type = "sinaplot", theme(axis.title.y = element_text(hjust=3.5)))

Error: ... is not empty.

We detected these problematic arguments:

  • ..1

These dots only exist to allow future extensions and should be empty. Did you misspecify an argument? Run rlang::last_error() to see where the error occurred.

Side note can we obtain a print out of specific values from the Gardner Altman plot? I've attached a picture to hopefully explain this a little better.

Thanks in advance!

Questions

coopert25 avatar Jun 26 '20 05:06 coopert25

Hi,

Thanks for your kind words.

I want to be able to control the y-axis title and move it closer to its y-axis.

Currently this is not possible.

For some reason, the snippet below doesn't work as expected either:

unpaired_mean_diff <- dabest(iris, Species, Petal.Width,
                             idx = c("setosa", "versicolor", "virginica"),
                             paired = FALSE)

my_theme <- theme_classic() + theme(axis.title.y = element_text(hjust=3.5))
plot(unpaired_mean_diff, theme = my_theme)

Ideally, I think the way forward would be something like that: modify a current theme, and pass it along to dabestr's plot() function.

josesho avatar Jun 30 '20 02:06 josesho

This was a perfect work around. Thank-you!

coopert25 avatar Jul 02 '20 02:07 coopert25