Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to readjust caxis on all subplots?

Tags:

matlab

So I have two subplots with different caxis values. Is there a way to use caxis([-2 2]) so that it could rescale the caxis for all of the subplots? There is a single function that produces each plot, and I want all of the plots to have the same caxis to facilitate comparison.

enter image description here

like image 445
InquilineKea Avatar asked Nov 23 '25 13:11

InquilineKea


1 Answers

Assuming that you have a handle to the figure containing the subplots, you can do the following:

subplots = get(fig_handle,'Children'); % Get each subplot in the figure
for i=1:length(subplots) % for each subplot
    caxis(subplots(i),[-2,2]); % set the clim
end

If you don't have the handle to the figure, just use gcf instead.

like image 170
MrAzzaman Avatar answered Nov 26 '25 23:11

MrAzzaman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!