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

5 次查看(过去 30 天)
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 个评论
Peter Stephen
Peter Stephen 2018-9-13

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 2018-9-13

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

请先登录,再进行评论。

采纳的回答

OCDER
OCDER 2018-9-12
Try this:
set(gcf, 'renderer', 'painters')
If that works, set the default too:
set(0, 'DefaultFigureRenderer', 'painters')
  3 个评论
OCDER
OCDER 2018-9-13

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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by