X and Y axis in subplots

조회 수: 4 (최근 30일)
Michelle Hernandez
Michelle Hernandez 2020년 8월 6일
답변: Ilya Gurin 2020년 8월 6일
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.

답변 (1개)

Ilya Gurin
Ilya Gurin 2020년 8월 6일
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

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by