Emily-Jane
Emily-Jane

Reputation: 21

How to remove the 'pairwise test' text on the right-hand side of the graph in ggstatsplot

i am having difficulty removing the text on the right hand side of my graph (pairwise test:Dunn, bars shown: not significant). can anyone help?

plot1 <- ggstatsplot::ggbetweenstats(
  data = boxplot.Age,
  x = cluster,
  y = Age,
  color = group,
  title = "Age Box Plot",
  subtitle = "Grouped by cluster", type="nonparametric", comparisons_correction = "holm",results.subtitle =FALSE,   pairwise.display = 'none')

enter image description here

I tried to use the argument pairwise.display = 'none' but it did not work

Upvotes: 2

Views: 521

Answers (2)

Nathan Stutzman
Nathan Stutzman

Reputation: 99

As noted in the ggstatsplot GitHub page (Issue #864), the secondary y-axis title can be removed by entering this as an argument to ggbetweenstats:

gplot.component = list(theme(axis.title.y.right = element_blank(), 
axis.text.y.right = element_blank(), 
axis.ticks.y.right = element_blank())

Alternatively, my preference would be to just add the component via the ggplot + syntax:

ggbetweenstats() +
theme(axis.title.y.right = element_blank(), 
axis.text.y.right = element_blank(), 
axis.ticks.y.right = element_blank())

Upvotes: 1

Indrajeet Patil
Indrajeet Patil

Reputation: 4879

Just set pairwise.comparisons = FALSE and that should turn off pairwise comparisons and will also remove the secondary axis label:

plot1 <- ggstatsplot::ggbetweenstats(
  data = boxplot.Age,
  x = cluster,
  y = Age,
  color = group,
  title = "Age Box Plot",
  subtitle = "Grouped by cluster", 
  type = "nonparametric", 
  pairwise.comparisons = FALSE,
  results.subtitle = FALSE
)

Upvotes: 0

Related Questions