X and Y axis in subplots
5 views (last 30 days)
Show older comments
How do I label the outer subplots of a 8x7 graph?
I made a 8x7 subplot, I want to label the top row with these labels
unique_sf = [0.0003 0.0006 0.3125 0.6250 1.2500 2.5000 5.0000 10.0000]
& label the left, outer most column with these labels:
unique_rotation = [ 0 30 60 90 120 150 180]
This is the code for the subplot:
count=1;
for j = 1:length(unique_rotation)
for i = 1:length(unique_SF)
subplot(7,8,count)
count = count+1;
plot(mean(dataT.bins(dataT.spatial_frequency == unique_SF(i) & dataT.rotation == unique_rotation(j),:,79)))
end
end
I do not need every individual subplot to be labeled, but that would work also.
I manually typed in textboxes for an example of what I want it to look like, but I haven't figured out how to do it myself. The picture attached shows the labels I want.
0 Comments
Answers (1)
Ilya Gurin
on 6 Aug 2020
You have a problem in that the structure of your plot (hardcoded as 7x8) is not linked to the structure of your data (unique_rotation and unique_SF). But the general approach I would take is this:
if i == 1
ylabel(sprintf('Orientation = %d', unique_rotation(j))
end
if j == 1
title('construct your string here')
end
if i == length(unique_SF)
xlabel('construct your string here')
end
0 Comments
See Also
Categories
Find more on Subplots 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!