Override automatic "X samples" subtitle in plots


Hi,

I’m generating custom MultiQC plots from external JSON files (e.g., from R). Everything works great — except that the plots always show a subtitle like "2 samples", which is not defined in my JSON or pconfig.

I’ve tried:

  • Setting subtitle: null or subtitle.text: "" in custom_plot_config — has no effect.
  • Post-processing the HTML with sed — this works but is a hack, and doesn’t fit nf-core clean standards.
  • Searching for a config option or CLI flag — I found none.

Would it be possible to:

  • Add a global or per-plot option to disable this subtitle, or
  • Respect subtitle: null or subtitle.text: "" when explicitly set?

This is the example JSON I’m using (toy case with 2 samples):

{
  "id": "nucleoside_fwhm",
  "section_name": "FWHM of nucleosides",
  "description": "Full Width at Half Maximum values across samples for selected nucleosides.",
  "plot_type": "linegraph",
  "pconfig": {
    "id": "fwhm_plot",
    "title": "FWHM per nucleoside",
    "subtitle": null,
    "xlab": "Sample",
    "ylab": "FWHM (sec)",
    "xlab_format": "category",
    "showlegend": true
  },
  "data": {
    "5-methylcytosine (m5C)": {
      "20240316_QCN1_002": 26.8
    },
    "1-methyladenosine (m1A)": {
      "20240316_QCN1_002": 24.9
    }
  }
}

I’ll also attach a screenshot showing the "2 samples" subtitle that still appears, despite trying to suppress it.

Thanks a lot for considering!

Roger

I found a way to remove the automatic “X samples” subtitle from MultiQC plots. The issue arises from the way the title is generated in the plot.py file.

Patch Applied:

In the file:
site-packages/multiqc/plots/plot.py

I commented out the following lines:

# PATCH: Disable automatic "X samples" subtitle
# if n_samples > 1:
#     subtitles += [f"{n_samples} samples"]

This effectively stops MultiQC from adding the “X samples” subtitle to plot titles while preserving other subtitles (if present).

Suggestion:

It would be great if MultiQC had a configuration option to disable the automatic “X samples” subtitle directly. This would make customization much easier and avoid manual patching.

Would it be possible to consider this feature in a future release?