Just wanting to add a custom palette to this visualization. I have tried adding it manually using palette = c("colour1", "colour2",...) and using custom_palette. Nothing is working. Is there a way to extract this data and run it in ggplot2?
Here is the code I am working with: #Multi-group analysis in dabestr
multi_groups <- load(data, x = Treatment, y = Total_CO2,
idx = list(
c("GB-L", "LDPE-L"),
c("GB-H", "LDPE-H"),
c("GF-L", "PA-L"),
c("GF-H", "PA-H") ))
print(multi_groups)
multi_groups.mean_diff <- mean_diff(multi_groups)
print(multi_groups.mean_diff)
multi_groups.mean_diff
#Plots
dabest_plot(multi_groups.mean_diff) <--- THIS IS WHERE I WANT TO CHANGE THE COLOUR PALETTE
dabest_plot(multi_groups.mean_diff, palette = c("colour1", "colour2"... etc) - did not change the colours
If you look at the documentation for
?dabest_plot, you will see that it only describes two named arguments, neither of which control the color, but the function also allows extra arguments to be passed via....We therefore need to look up the documents for
?plot_kwargsto find out how to control the color palette. Here we find that there is an argument calledcustom_palette:Essentially, these are the palettes you are stuck with. Although the final object produced by the
dabest_plotfunction is a ggplot object, it is actually acowplottype ggplot, meaning one cannot simply add new color and fill scales to it.To be fair, there are several palettes to choose from, all of which give quite a professional look.
Here's an example:
And here with a different palette:
From looking at the code of the package, it doesn't look as though it would be terribly difficult to add in a fully customizable palette, but it seems that this is not a priority for the authors right now.