MATLAB: Is pixelation observed in a PDF generated by the PRINT command when raster based rendering is used in MATLAB 7.7 (R2008b)

MATLABopenglpainters

I am creating a figure which contains transparent objects. I am printing this figure as a PDF file using the PRINT command. I am using the OpenGL renderer to render the output PDF. I notice pixelation in the output both on the content of the axes as well as the axes labels, legends and ticks.
The code used to generate the figure is below. The problem is not specific to the objects being drawn. It depends on the rendering mode used in the PRINT command.
h = patch([0 1 0.6], [0 1 0.8], 0.85*[0,1,0]);
set(h,'FaceAlpha', 0.65, 'EdgeColor',[0,0,0],'EdgeAlpha',1, 'LineWidth',2);
h = patch([0 0.6 0.6], [0 0.2 0.8], 0.5*[0,1,0.5]);
set(h,'FaceAlpha', 0.65, 'EdgeColor',[0,0,0],'EdgeAlpha',1, 'LineWidth',2, 'LineStyle','-.');
xlabel('X-axis'); ylabel('Y-Axis'); title('Title'); grid on
legend({'Patch1', 'Patch2'});
print(gcf, '-opengl', '-dpdf', 'pdf_opengl.pdf');

Best Answer

The main issue is that when a raster-based renderer is used, the entire image is converted into pixels and hence pixelation is observed when zooming into the PDF.
As possible workarounds, you can do one of the following:
1. Select the rendering mode to be painters. This can be done as follows
print(gcf, '-painters', '-dpdf', 'pdf_painters.pdf')
This will remove any transparencies in the objects.
2. Increase the DPI of the output
print(gcf, '-opengl', '-r1116', '-dpdf', 'patch_pdf_painters.pdf')
This will retain the transparencies of objects. However, pixelation will still be observed when zooming in to a high level of detail.