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.

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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With