samexaxis (nice subplots with same x axis)

Makes it alot easier to make nice figures with the same x axis.
13,7K Downloads
Aktualisiert 29 Mär 2005

Keine Lizenz

Features:

* Automatically sets xlim to the same for all subplots Removes xticklabels where it is not needed.
* Can join a subplots (if it is made with subplot instead of subaxis)
* Can set the ylabel position to the same for all subplots
* Can almost allways avoid that the yticklabels are written on top of each other
* Can automatically add a),b),c) to each subplot

----------
% helper function to clean up subplots that have common x axises

USAGE: samexaxis([optionalarguments])

Optional arguments:
* YAxisLocation (default='left') : choose left,right, alternate or alternate2
* XAxisLocation (default='bottom') : choose bottom,top or both
* YLabelDistance (default=1.4)
* Box (default='on')
* XTick
* XTickLabel
* XMinorTick
* ABC : add a),b),c), ... to each sub plot
* Join: joins the subplots vertically
* YTickAntiClash: try to aviod yticklabel clashes (default=false)


Example:
subplot(3,1,1);
plot(randn(100,1),randn(100,1),'x');
ylabel('QF')
subplot(3,1,2);
plot(randn(100,1),randn(100,1)*10,'x');
ylabel('HT');
subplot(3,1,3);
plot(randn(100,1),randn(100,1)*33,'x');
ylabel('DV');

samexaxis('abc','xmt','on','ytac','join','yld',1)

Zitieren als

Aslak Grinsted (2024). samexaxis (nice subplots with same x axis) (https://www.mathworks.com/matlabcentral/fileexchange/7169-samexaxis-nice-subplots-with-same-x-axis), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R14
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Combine Multiple Plots finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

Made more clever ytickanticlash. Should no longer hide lines exactly at the ylimits. And it will not change ylimits of axes that doesn't have ylim set to auto.