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

5 vues (au cours des 30 derniers jours)
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 commentaires
Peter Stephen
Peter Stephen le 13 Sep 2018

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).

Peter Stephen
Peter Stephen le 13 Sep 2018

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

Connectez-vous pour commenter.

Réponse acceptée

OCDER
OCDER le 12 Sep 2018
Try this:
set(gcf, 'renderer', 'painters')
If that works, set the default too:
set(0, 'DefaultFigureRenderer', 'painters')
  3 commentaires
OCDER
OCDER le 13 Sep 2018

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

Peter Stephen
Peter Stephen le 13 Sep 2018
OCDER: Thanks a lot for this advice!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by