Two figures have different sizes when plotted using contourf and colorbar
3 views (last 30 days)
Show older comments
Kristin Busa
on 12 May 2014
Commented: Star Strider
on 13 May 2014
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
0 Comments
Accepted Answer
Star Strider
on 12 May 2014
Even when I enlarge the figure boxes, I don’t see the shift, or the problem with the colorbar.
My machine: HP laptop, Win 8 64, latest videodrivers, MATLAB R2014a.
3 Comments
Star Strider
on 13 May 2014
My pleasure!
I’m glad the -loose option worked for you. I haven’t done anything with Postscript or Ghostscript in a while, so I forgot they existed.
I haven’t had any need for a PDF-to-Postscript converter, so I haven’t had any experience with pdftops. According to the Xpdf description, it apparently needs to be compiled to use it.
I just now did a brief search (on DuckDuckGo) for ‘pdf to postscript converter windows’ and came up with several hits. You might want to do a similar search to see if one of them would work for you.
I use PDF-XChange for everything related to PDFs. MATLAB creates decent PDFs, and I can view and manipulate them with PDF_XChange easily. It doesn’t convert PDFs to Postscript, though.
Have fun with your research!
More Answers (1)
See Also
Categories
Find more on Historical Contests 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!