Strange print function behavior related to output resolution and zoom level using filled patch objects

1 view (last 30 days)

Hello all,

I've prepared some figures which display a bunch of information in a local coordinate system. When plotting this figure to a png file using print:

print(gcf,'-dpng','-r400','file.png');

The results look like:

So cutting off a part of my patch object, though when I'm exporting my figure to pdf using

print(gcf,'-dpdf','-r400','file.pdf');

OR to png using:

print(gcf,'-dpdf','-r0','file.png');
saveas(gcf,'file.png','png');

I get the following results (which are correct):

So it appears that a higher png resolution results in my green patch object being cut off.

Strikingly, when plotting the identical figure, though zooming out for a bit, but again using png and the higher resolution ('-r400'), so using the above code which created the initial problems again:

print(gcf,'-dpng','-r400','file.png');

The result is a follows:

Which is just fine, as I've zoomed out the figure. Quite strange indeed!

So it appears that the cuts in my patch objects are not only related to the output resolution, but also patch connection points being outside of my current plot (XLim and YLim). Is there anyone who can clarify anything about this to me, as I cannot come up with a good reason, let alone, a solution..

Kind regards,

Freek

  2 Comments
AJ von Alt
AJ von Alt on 22 Jan 2014
What renderer is the figure using?
Copy and paste the output from:
get( gcf , 'Renderer' )
What version of MATLAB are you using? You can get the version nummber using the command:
ver MATLAB
Freek
Freek on 22 Jan 2014
Thanks for your response, I am using Matlab 2013a 64 bit (can switch to any other version if you think it can be relevant). The renderer is set to its default using these functions, which is painters, I've also tried using OpenGL and zbuffer, but the same problem occurs..

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!