Cropped off markers when exporting figures as PNG

2 views (last 30 days)
Hello,
I have run into an issue where seemingly randomly - though probably only at the periphery of graphs, circular markers are cropped off leaving arcs when exporting to PNG. I've attached one example of code and produced figure below - I have not tested if any of the messing with the defaults is critical in producing this - just set them how I generally like my figures. I'm using OpenGL, which I believe is part of the problem since I don't recall having these issues when working on a hardware accelerated system. Running 9.2.0.556344 (R2017a) on Win7 64-bit i7 system with Intel HD 530 graphics - attaching sysinfo png.
Best regards,
/Jonas
%cropcircledemo.m set(0,'DefaultAxesFontsize',12); set(0,'DefaultLineLinewidth',2); set(0,'DefaultLineMarkersize',10);
x=[0.1009 0.1011 0.1020 0.1613 0.2339 0.3051 0.3654 0.4284 0.4901 0.5798 0.6720 0.7530 0.8240 0.1007]; y=[14.6900 14.8100 15.0500 15.2800 15.5200 15.7400 15.9300 16.1400 16.3300 16.6100 16.9100 17.1700 17.4000 14.6900];
figure(10); clf; plot(x,y,'o');
print cropcircledemo.png -dpng -r600

Accepted Answer

Michael Dombrowski
Michael Dombrowski on 29 Jun 2017
Your issue can be resolved by changing either the resolution (DPI) or the renderer.
Try the following code:
% do not use opengl
print cropcircledemo.png -dpng -r600 -painters
% use any other dpi
print cropcircledemo.png -dpng -r700
  1 Comment
Jonas Gustavsson
Jonas Gustavsson on 29 Jun 2017
Thanks Michael! I would call these work-arounds, but I'll still accept the answer - hopefully later Matlab versions will improve the handling of this - don't believe it used to behave like this.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!