pdf/eps export; dotted line plot shows random markers on the line

Hey everybody,

I am trying to create a simple plot with a dotted line. However,
depending on the export format I use, I get random markers on the
line. This effect appears for pdf but not for png. When I use eps and
convert the eps file to pdf I also receive the random markers.

I use the following script to generate the plot. The resulting graph
on my system is attached to this mail.

#!/usr/bin/env python
import numpy as np
a = np.linspace(0.,10.,100)
b = np.sqrt(a)
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
fig.add_subplot(ax)
ax.plot(a, b, linestyle = ':', color = 'k', linewidth = 3)
fig.savefig('broken.pdf')

My system is:

Linux 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012
x86_64 x86_64 x86_64 GNU/Linux

I am using matplotlib version '1.1.0'.

Any help is greatly appreciated.
Benjamin

broken.pdf (7.53 KB)

No extra "stuff" in the png and pdf plots in my case (changed the hash-bang line):

Mac 10.7.4 w/ python and matplotlib from (not too recent) Fink:
i python27 1:2.7.2-5 Interpreted, object-oriented language
i python27-shlibs 1:2.7.2-5 Interpreted, object-oriented language
i matplotlib-base 1.0.2-1 Plot data on map projections with matplotlib
i matplotlib-py27 1.1.0-2 Pure python 2D plotting with a Matlab syntax

-Dale

···

On Jun 9, 2012, at 13:00 , Benjamin Jonen wrote:

Hey everybody,

I am trying to create a simple plot with a dotted line. However,
depending on the export format I use, I get random markers on the
line. This effect appears for pdf but not for png. When I use eps and
convert the eps file to pdf I also receive the random markers.

I use the following script to generate the plot. The resulting graph
on my system is attached to this mail.

#!/usr/bin/env python
import numpy as np
a = np.linspace(0.,10.,100)
b = np.sqrt(a)
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
fig.add_subplot(ax)
ax.plot(a, b, linestyle = ':', color = 'k', linewidth = 3)
fig.savefig('broken.pdf')

My system is:

Linux 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012
x86_64 x86_64 x86_64 GNU/Linux

I am using matplotlib version '1.1.0'.

Any help is greatly appreciated.
Benjamin
<broken.pdf>------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Benjamin Jonen:

I get random markers on the
line. This effect appears for pdf but not for png. When I use eps and
convert the eps file to pdf I also receive the random markers.
...

For me your PDF is OK, nothing "broken". I get exactly the same (mpl 1.1.0, on Windows XP, Python 2.7).
Your problem has probably nothing to do with matplotlib...

Jerzy Karczmarczuk

Hey guys,

thanks for the quick replies. You are right, the problem appears to be
related to my pdf viewer (okular). More concretely, pdf viewers based
on the poppler library (e.g. xpdf, qpdfview) show the same problem in
ubuntu 12.04. Everything works fine with evince or acroread.

Thanks,
Benjamin

···

On Sat, Jun 9, 2012 at 7:43 PM, Jerzy Karczmarczuk <jerzy.karczmarczuk@...3937...> wrote:

Benjamin Jonen:

I get random markers on the
line. This effect appears for pdf but not for png. When I use eps and
convert the eps file to pdf I also receive the random markers.
...

For me your PDF is OK, nothing "broken". I get exactly the same (mpl
1.1.0, on Windows XP, Python 2.7).
Your problem has probably nothing to do with matplotlib...

Jerzy Karczmarczuk

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users