Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


h=2304; w=3072;


print(gcf, 'test.pdf', '-dpdf');
share|improve this question

migrated from May 18 '11 at 18:16

This question came from our site for users of TeX, LaTeX, ConTeXt, and related typesetting systems.

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 May 18 '11 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 May 18 '11 at 16:53
Try issuing set(gcf,'PaperPositionMode','Auto','PaperType','a4') before you print the image. – Jake May 18 '11 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 May 18 '11 at 21:19

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.