1

I'm using false-color visualizations for some HDR images in MATLAB, but with large images I find that the colorbar labels get cut off.

In the MWE below, colorbar labels (and I think some of the colorbar too) have been cut off when I print to PDF for inclusion in LaTeX. I've uploaded the output I'm getting here.

Can anyone suggest a fix? Thanks.

MATLAB Code:

h=2304; w=3072;
y=(1:1:2304)';
x=1:1:3072;
z=y*x;

figure();
imshow(z,[]);
colormap(jet);
colorbar;

print(gcf, 'test.pdf', '-dpdf');
4
  • It works fine with Matlab R2010b on Linux. Maybe you could upload your test.pdf and also add a MWE example of your .tex file to show how you include the PDF into your document?
    – Jake
    Commented May 18, 2011 at 14:13
  • @Jake: thanks for the reply. I've updated my post with a link to the output file I'm getting and slightly different code just to make the file smaller; the problem is still the same. Thanks.
    – SSilk
    Commented May 18, 2011 at 16:53
  • Try issuing set(gcf,'PaperPositionMode','Auto','PaperType','a4') before you print the image.
    – Jake
    Commented May 18, 2011 at 17:37
  • @Jake: Just tried that, it didn't work. It actually cut off more stuff than before, including a big chunk of the image.
    – SSilk
    Commented May 18, 2011 at 21:19

1 Answer 1

1

Worked fine on 2008b here, but the bounding box is wrong for what people normally expect on an embeddable graph. MATLAB has always treated PDF export as a special case of printing to a regular printer, when it should be analogous to making an EPS.

What I normally do for LaTeX is create an EPS file, and then convert it to PDF. I wrote a pdfprint.m file some time back to automate that. It should work on any Windows or UNIX-like system with MATLAB and epstopdf (standard with LaTeX). You can download it here.

Also, the pdflatex in TeX Live 2010 can automatically convert EPS graphics to PDF when needed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .