Matlab rasterizing vector graphics

4 views (last 30 days)
I am running Matlab 2017b on Ubuntu 18.04 LTS and I am having an issue while saving figures as vector graphics (PDF/EPS/SVG); the figures are rasterized in low resolution. I was also getting this warning:
Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information, click here.
The help on this topic says that I shold install proprietary drivers and not use open-source substitutes. I do not have a dedicated discrete graphics card and am using the inbuilt Intel HD630 graphics controller.
I tried the following :
  • Starting Matlab with -nosoftwareopengl option. It initially gave me this error:
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Segmentation fault (core dumped)
  • Renamed libstdc++.so.6 as mentioned in this post but the problem of graphics persited.
  • Installed libglu1-mesa-dev freeglut3-dev mesa-common-dev but again no effect.
  • Tried opengl hardware on Matlab shell but I got this error: Switching to hardware OpenGL rendering at runtime on unix is not supported.
  • I have been using Matlab on linux for a long time but I never had this problem. In fact I have some figures exported from this very installation. So it seems that there is an incompatibility with some Ububtu update. The libstdc++6 vesion on the system is libstdc++.so.6.0.25 while the one that is in the Matlab directory is libstdc++.so.6.0.20
How do I fix this problem?

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 31 Jan 2019
Edited: Bjorn Gustavsson on 31 Jan 2019
I was under the impression that we only get proper vector-graphics when using the painters renderer, and that we get rasterized figures when we use zbuffer or opengl (or that matlab decides to use either of those two). My solution to this is to allways print with the -painters flag to get vector graphics - this was to avoid some imlpicit choise of zbuffer/opengl by matlab when figures became "too busy"(?). This does of course not work if you have figures with transparent objects and produce some "randomly interesting" figures of 3-D plots.
Does your problem go away if printing with the -painters flag?
HTH
  1 Comment
Bharat Ravi
Bharat Ravi on 31 Jan 2019
Thank you.
It works with -painters flag. I didn't know that it was not chosen by default. At least it used to work without explicitly specifying the flag.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Tags

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!