# How to adjust summary plot figure

**URL:** <https://forum.biobakery.org/t/how-to-adjust-summary-plot-figure/7895>\
**Category:** Downstream analysis and statistics\
**Created:** [March 5, 2025, 7:32pm UTC](https://forum.biobakery.org/t/how-to-adjust-summary-plot-figure/7895 "2025-03-05T19:32:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafaela](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@Rafaela](https://forum.biobakery.org/u/Rafaela)\
**Post date:** [March 5, 2025, 7:32pm UTC](https://forum.biobakery.org/t/how-to-adjust-summary-plot-figure/7895/1 "2025-03-05T19:32:09Z")

</div>

Hello,  
I’m using MaasLin3, but I can’t seem to adjust my x-axis in the summary plot. Do you think the settings would be similar to those for ggplot? Any help you could offer would be much appreciated. Thanks!

 ![Screenshot from 2025-03-05 16-25-58](https://canada1.discourse-cdn.com/flex027/uploads/biobakery/original/2X/d/d7972cbd1f7cc9ae7d4570d975b2a4e81eec3590.png)

---

<div class="post-metadata">

**Author:** ![WillNickols](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/willnickols/32/3223_2.png) [@WillNickols](https://forum.biobakery.org/u/WillNickols)\
**Post date:** [March 5, 2025, 7:51pm UTC](https://forum.biobakery.org/t/how-to-adjust-summary-plot-figure/7895/2 "2025-03-05T19:51:45Z")

</div>

Hi Rafaela,

The functions `maaslin_plot_results` and `maaslin_plot_results_from_output` (run on your outputs) will return lists of `patchwork` objects which themselves contain the `ggplot2` objects. If you overwrite the old objects with the edited objects (e.g., by adding `+ scale_x_continuous(breaks = c(-1, 0, 1))`), the plots will display your modifications.

Will

---

<div class="post-metadata">

**Author:** ![gjordaopiedade](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/gjordaopiedade/32/2733_2.png) [@gjordaopiedade](https://forum.biobakery.org/u/gjordaopiedade)\
**Post date:** [July 18, 2025, 12:13pm UTC](https://forum.biobakery.org/t/how-to-adjust-summary-plot-figure/7895/3 "2025-07-18T12:13:08Z")

</div>

Hi Will,

When I tried replotting the results, only the individual association plots are stored as a list. The summary plot just gets replotted to the output folder instead of being stored in the list. Am I missing something?

Thanks in advance!  
Best wishes,  
Gonçalo

replotting code:

```auto
scatter_plots <- maaslin_plot_results_from_output(
  output = 'output_directory_rv',
  metadata = samples_rv_maaslin,
  normalization = "NONE",
  transform = "LOG",
  median_comparison_abundance = F,
  max_significance = 0.1,
  plot_summary_plot = TRUE,
  summary_plot_first_n = 10)

```

---

<div class="post-metadata">

**Author:** ![WillNickols](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/willnickols/32/3223_2.png) [@WillNickols](https://forum.biobakery.org/u/WillNickols)\
**Post date:** [July 18, 2025, 6:25pm UTC](https://forum.biobakery.org/t/how-to-adjust-summary-plot-figure/7895/4 "2025-07-18T18:25:46Z")

</div>

Hmm, I’m not sure just by looking at it. This works for me; do you get the summary plot when you do this?

```auto
# Read abundance table
taxa_table_name <- system.file("extdata", "HMP2_taxonomy.tsv", package = "maaslin3")
taxa_table <- read.csv(taxa_table_name, sep = '\t', row.names = 1)

# Read metadata table
metadata_name <- system.file("extdata", "HMP2_metadata.tsv", package = "maaslin3")
metadata <- read.csv(metadata_name, sep = '\t', row.names = 1)

# Factor the categorical variables to test IBD against healthy controls
metadata$diagnosis <- 
    factor(metadata$diagnosis, levels = c('nonIBD', 'UC', 'CD'))
metadata$dysbiosis_state <- 
    factor(metadata$dysbiosis_state, levels = c('none', 'dysbiosis_UC', 'dysbiosis_CD'))
metadata$antibiotics <- 
    factor(metadata$antibiotics, levels = c('No', 'Yes'))

set.seed(1)
fit_out <- maaslin3(input_data = taxa_table,
                    input_metadata = metadata,
                    output = 'hmp2_output',
                    formula = '~ diagnosis + dysbiosis_state +
                        antibiotics + age + reads',
                    normalization = 'TSS',
                    transform = 'LOG',
                    augment = TRUE,
                    standardize = TRUE,
                    max_significance = 0.1,
                    median_comparison_abundance = TRUE,
                    median_comparison_prevalence = FALSE,
                    max_pngs = 250,
                    cores = 1)

outputs <- maaslin_plot_results_from_output('hmp2_output', metadata = metadata, 
                                 normalization = 'TSS', transform = 'LOG')

outputs$summary_plot$final

```
