How to combine subplots so they share axes?
Mostra commenti meno recenti
I have a 2x2 subplot. All four subplots have the same x and y axes. I would like to combine the four subplots so that they share axes, making the plot less busy. So, for example, the east y axis of the west plots would be the west y axes for the east plots. Is there as simple way to do this? I can't seem to find anything. I'm using 2018a. Thank you all!
5 Commenti
dpb
il 7 Ott 2018
Not sure exactly what your trying to describe but I think you're looking for yyaxis in only two subplots 2x1, maybe...
Erik J
il 7 Ott 2018
dpb
il 8 Ott 2018
"...if that makes sense."
I'm sure it does to you, but I can't envision your intent, sorry.
Can you show an illustration of how you'd like the plot to look?
dpb
il 8 Ott 2018
Oh...this morning I think I grok. You can reposition the four subplots so they overlay. You'll have to be creative in hiding which axes labels, etc., etc., ... are visible but could probably get something useful.
jonas
il 8 Ott 2018
I'd go straight for one of the FEX functions like tight_subplot (my personal choice, but there are more recent ones).
Risposte (1)
jonas
il 8 Ott 2018
Here's an example using the tight_subplot function from FEX
ax = tight_subplot(2,2,0,0.1,.1);hold on
set(ax,'color','none')
set(ax(3:4),'xcolor','none')
set(ax([1 3]),'ycolor','none')
set([ax.XRuler],'tickdirection','both')
set([ax.YRuler],'tickdirection','both')
for i=1:4
axes(ax(i));hold on
plot(rand(10,10))
end
linkaxes(ax,'xy')

. Just add some ticklabels!
Categorie
Scopri di più su Subplots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!