Problem using circles as marker type when linewidth > 0.5 (default)... using Matlab R2018a

I would like to plot a graph showing two different data sets, using circles for one set and squares for the other. However, when I make the linewidth corresponding to the circles larger than the default value of 0.5, these circles are rendered incompletely (see attached .fig file).

6 Comments

Uploading a .fig is not ideal, especially when you have a rendering problem. Can you upload a .jpg? I opened the .fig without issue. Here is a printed version:
Many thanks for your rapid response. Here is a .jpg to indicate the (circle rendering) problem I am having.
I see the issue now. Did you try OCDER's solution?
@Peter: Did you update the drivers of your graphics card? Try this also:
opengl software
or
opengl hardward

Thank you Jonas, Jan and OCDER for your suggestions. Unfortunately, both opengl hardware and set(gcf, 'renderer', 'painters') do nothing to solve the problem; the circles continue being incompletely rendered. On the other hand, opengl software leads to complete circle but of poor resolution. The resolution of the squares is also affected - see attached .jpg

Maybe the only solution for me would be to go back to using an older version of matlab (e.g. 2017a).

There is no resolution issue for .svg, .pdf and .emf formats, so it seems opengl software has done the trick! Thanks again.

Sign in to comment.

 Accepted Answer

Try this:
set(gcf, 'renderer', 'painters')
If that works, set the default too:
set(0, 'DefaultFigureRenderer', 'painters')

3 Comments

I would not modify the default renderer to fix one problem. Maybe sometimes later other problems might be based on a fixed renderer, so hesitate to set the properties globally, but only where it is required.

Oh, were you having issues with saving the file, or the figure not showing correctly on screen? How were you saving the images? Using vector graphics like you are doing now (pdf, eps, emf) is probably best, as you don't lose resolution. But if you want the other file types, try this:

    print(gcf, 'test.png', '-dpng', '-r600', '-painters')
  or 
    print(gcf, 'test.png', '-dpng', '-r600', '-opengl')

If you used saveas, then you'll run into resolution issues, especially with jpg formats, due to loss of quality for jpeg formats and also saveas dialog box uses a 150DPI resolution. See the Tips in the way bottom of this page:

https://www.mathworks.com/help/matlab/ref/saveas.html

Tips

  • To control the size or resolution when you save a figure, use the print function instead.
  • The saveas function and the Save As dialog box (accessed from the File menu) do not produce identical results. The Save As dialog box produces images at screen resolution and at screen size. The saveas function uses a resolution of 150 DPI and uses the PaperPosition and PaperPositionMode properties of the figure to determine the size of the image.

You could also try this popular tool for saving images

https://www.mathworks.com/matlabcentral/fileexchange/23629-export_fig

Sign in to comment.

More Answers (0)

Categories

Find more on Printing and Saving 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!