Reputation: 347
I am creating a 3x1 outer plot in Matlab. Within each outer plot I want to have a 5x1 inner plot. For every 3x1 outer plot, I want separate y axis labels. I also want each 5x1 inner plot to have its own y-axis label. All plots will have the same x-axis label.
I have been using Matlab's tiledlayout
function. I am struggling with how to create the nested 5x1 inner plots though and how to give each inner plot its own distinct label. This is what I have so far:
close all
f = figure;
subj_plot = tiledlayout(3,1);
% Iterate through all subject
for subj = 1:3
nexttile
ylabel(['\bf Subject', num2str(subj)]);
for fing = 1:5
end
end
xlabel('test');
subj_plot.TileSpacing = 'compact';
Overall the figure will be 15x1 with groupings of 3x1. I am not sure how to set this up, and how to nest a tiled layout figure within a figure with distinct labels using hold on. I How can I do this?
EDIT: each individual 15x1 plot will have two graphs over-layed on each other.
Upvotes: 2
Views: 661
Reputation: 1283
I don't have the function tiledlayout
(my Matlab is older than R2019b) so I cannot reproduce this exactly. I would consider using text
as opposed to ylabel
for the outer plots, something like this:
% define ax = get axis for each subplots in your tiled layout
ax.Units = 'pixels';
h = text(ax.Position(1)+ax.Position(3)/2, ax.Position(2)+ax.Position(4)/2, 'Your Outer Axis Label', 'Units', 'pixels', 'HorizontalAlignment', 'center', 'Rotation', 90);
You could of course drag the text manually too if reproducibility is not a concern here.
Upvotes: 0