Misplaced line markers after saving as eps/pdf

10 views (last 30 days)
Every time I save a plot with both a line and line markers in a vector format (eps or pdf), the resulting file misplaces all of the line markers. Specifically, they seem to always sit above the line. As an example, let's say I run the following line of code:
plot(1:0.1:5,'ro-','MarkerSize',4,'LineWidth',0.75,'MarkerFaceColor','r')
As you would expect, the result on my screen looks like this (and is identical when saved as a png file):
However, if I then save the exact same figure in eps format, it looks like this:
The problem is a little subtle, but I'm trying to make some large and complicated plots with multiple lines and hundreds of points like this. In that scenario, this becomes a huge problem.
As for details on my Matlab version, etc: I'm running on Mac OSX (El Capitan), and I first encountered the problem earlier using Matlab 2015b. After trying in vain to fix this for hours, I uninstalled my copy of 2015b and installed Matlab 2016b, and the problem persisted. (Interestingly, the misplacement of the line markers using 2015b was much more variable: sometimes they were below the line, sometimes above. Also there was variation in the horizontal direction, which I don't get now in 2016b.)
Furthermore, it doesn't appear to matter what method I use to save the file. I've tried Matlab's save-as gui with eps and pdf; I've tried changing export options in the gui; I've tried saving at the command line both using Matlab's built-in functions and export_fig() from the file exchange. All of these reproduce the same behavior. I've also tried viewing the resulting vector images with a variety of different programs (Acrobat, Illustrator, Mac's Preview, etc.), and they all produce identical outputs on the screen.
I'd greatly appreciate anyone's help on this. Thanks in advance!!
  2 Comments
Jan
Jan on 7 Mar 2017
Edited: Jan on 7 Mar 2017
+1: Thanks for the exhaustive description of what you have tried so far. The readers will not waste their and your time with suggesting export_fig and a different PDF viewer. Are you sure that the markers are misplaced or could it be the line instead? Which renderer is used - OpenGL or Painters?
I suggest to contact TMW, if this is a known bug.
chuckn
chuckn on 7 Mar 2017
Thanks for your comment! Regarding your questions, I've checked on the line, and it's in the right place. So I believe it's the markers that are misplaced. And the renderer I'm using is Painters. OpenGL works just fine, but it produces bitmap images, whereas I need vector images. I've looked pretty extensively and haven't been able to find mention of this bug anywhere else. But I'll contact TMW and see if they have a fix for it.

Sign in to comment.

Accepted Answer

chuckn
chuckn on 7 Mar 2017
If anyone else runs into this problem, I contacted Mathworks and they found a great workaround for this. It's apparently a problem specific to the circle marker. If you instead use a (large) dot marker, the problem goes away. For the example above, one could modify the line of code to this:
plot(1:0.1:5,'r.-','MarkerSize',10,'LineWidth',0.75,'MarkerFaceColor','r')

More Answers (0)

Categories

Find more on Interactive Control and Callbacks 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!