Two figures have different sizes when plotted using contourf and colorbar
Show older comments
Hello,
I am using contourf to plot two different figures. Below is sample code which runs using the .mat file attached.
clear all; close all; clc;
load contourfproblemdata.mat;
figure1 = figure('Position',[400 300 300 300]);
contourf(X,Y,data1,50,'linestyle','none'); axis equal; hold all;
colormap gray; xlim([-100 100]); ylim([-100 100]);
colorbar;
figure2 = figure('Position',[400 300 300 300]);
contourf(X,Y,data2,50,'linestyle','none'); axis equal; hold all;
colormap gray; xlim([-100 100]); ylim([-100 100]);
colorbar;
If you flip back and forth between figure1 and figure2, you'll see that the plots shift slightly, and that the colorbar on figure2 is partially obscured (the black border is somewhat missing from the left side of the colorbar).
Any help would be much appreciated!
Thanks, Kristin
Accepted Answer
More Answers (1)
Kristin Busa
on 13 May 2014
Categories
Find more on Contour Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!