Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

Why does my printed figure have poor resolution?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-16VZI
Product:   MATLAB
Reported in Release:   R11
Platform:   All Platforms
Operating System:   All OS
 

Subject:

Why does my printed figure have poor resolution?

Problem Description:

Why does my printed figure have poor resolution?

I specify the same properties in two plots of the following M-file. However, the second plot seems to be using a different renderer and produces a poor resolution printout. Also the title of the second plot overlaps the top line of the figure box. Here is an example that demonstrates the problem:

x = 0:0.01:10;
y1 = sin(x);
y2 = cos(x);
y3= tan(x);

t = [1:600];
plot(x(t), y1(t),'k.', x(t), y2(t),'k.', x(t), y3(t),'k.', 'MarkerSize', 3);
title('Test Plot', 'FontName', 'Arial', 'FontSize', 18);
axis([0 10 -1 1]);
print

figure
plot(x, y1,'k.', x, y2,'k.', x, y3,'k.', 'MarkerSize', 3);
title('Test Plot2', 'Fontname', 'Arial', 'FontSize', 18)
axis([0 10 -1 1]);
print

Solution:

MATLAB has several rendering methods available: painters, ZBuffer, and OpenGL.

When a figure has many objects in it, large 3D objects in it, or greater scene complexity in general, MATLAB switches the renderer to ZBuffer or OpenGL. These renderers are much faster at rendering, but they do not have associated printing instructions for preserving the graphics quality when printing to a file or to a printer. Instead, they blit the graphics data to a bitmap, which, when printed, can result in poor resolution. Using painters for complex scenes can result in large memory usage and file sizes, resulting in slow print jobs. Therefore, when using these renderers, you need to understand the tradeoff between print quality and print speed.

Additionally, there are some cases where the painters or ZBuffer renderer will not be able to achieve the desired graphics you require. For example, if your scene has transparency, the only renderer that supports this is OpenGL. MATLAB will choose this for you automatically, but you need to understand the implications this has on your print job.

For further information on graphics rendering in MATLAB please see Technical Note 1201:

Graphics Rendering and Troubleshooting Guide
http://www.mathworks.com/support/tech-notes/1200/1201.shtml


In order to address the issue of poor resolution, please consider the following example:

figure
plot(rand(5))
print

figure
surf(peaks(60))
print

The first figure will print using painters, since it is a simple plot of five lines. The second figure is more complex, so MATLAB switches to the OpenGL renderer.

To force MATLAB to use the painters renderer, as in the first printout, you can specify the "-painters" flag in the second print command.

print -painters

If you need to print in OpenGL in order to preserve transparency, but would like to retain the better graphics quality, then you need to specify a resolution when printing, using the -r flag. Note that the default resolution is 150, so you will want to choose something much higher. The following example will illustrate this by printing the default resolution as well as a better resolution:

figure
surf(peaks)
alpha(.5)
title('Default resolution = 150')
print
title('Better resolution = 500')
print -r500

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page