One common xlabel and ylabel for multiple subplots
Show older comments
Is there a straightforward way to add one common x label and ylabel to a figure containing multiple subplots?
The solutions I read so far require a file exchange function or a fixed number of subplots, and my number of subplots ranges from 5 to 10 (generally in one column).
I'm imagining there must be a way to determine the overall figure size, regardless of the number of subplots, and center a single xlabel and ylabel on each axis of the larger figure.
Accepted Answer
More Answers (1)
Image Analyst
on 30 Dec 2020
1 vote
If you have R2018b or later, use sgtitle().
4 Comments
Matthew Anderson
on 11 Dec 2021
This solution does not solve the axis labelling problem.
Charles Daigle
on 17 Feb 2022
i'm not sure why MathWorks would implement a solution to labeling a set of plots titles at once, but not their axes (in the case they are arranged to imply a common axis)
Stephen
on 27 Sep 2022
Ughhhhhh
Image Analyst
on 27 Sep 2022
@Charles Daigle I'm not sure what you mean. You can give a title to each axes with title. Perhaps if you posted a screenshot. Do you mean that you don't want each y axis to have it's own label and you want a single y label for, say, a stack of 10 plots? You know you can just have no label and use text to put up a vertical label to the left of all your plots positioned and rotated however you like.
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!