Adding different colorbars to each row of subplots? Removing subplot axes? Decrease subplot spacing?
Ältere Kommentare anzeigen
I am having a hardtime figuring out how to do a few things to a subplot. I will list them below:
- COLORBAR: When I try to add colorbars to each row of subplots in a 4x5 subplot figure (see image attached), It adds all the colorbars to the lower right corner. Two things wrong with this... 1) i need one colorbar for each row corresponding to that particular color. 2) I would like the colorbar to be outside of the subplot so that each subplot is the same shape. I indicated this on the attached image with the black markings.
- AXES: I would like to remove the y axes from each subplot except for the one on the left side (column 1). Similarly, I'd like to remove the x axis from each subplot except for the bottom (row 5).
- SPACING: I would like to decrease the spacing in between each subplot.
I included a more simplified version of my code below. Thanks so much in advance.
count = 0;
ax = zeros(4,5);
for i = 1:length(cells)
for k = 1:length(Sess)
count = count+1
ax(i,k) = subplot(4,5,count);
imagesc(CSbyShut); hold on;
set(gca,'XTick',0:150:600);
xticklabels({'-5','0','10','15','20'})
caxis([-5 15])
set(gcf, 'Position', [100, 100, 1500, 800])
xline(150,'-r');xline(450,'-r');
end
end
for t = [1,5,9,13,17]
colormap(ax(t),Map.blackmap);colorbar;
end
for t = [2,6,10,14,18]
colormap(ax(t),Map.bluemap);colorbar;
end
for t = [3,7,11,15,19]
colormap(ax(t),Map.greenmap);colorbar;
end
for t = [4,8,12,16,20]
colormap(ax(t),Map.redmap);colorbar;
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Subplots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!