Description
Points can be rasterized by setting their zorder
attribute to a value less than the rasterization_zorder
value of the current axes. However, I cannot get this to work if I set markeredgecolor
to 'none'
. Here is an example:
import matplotlib.pyplot as plt
ax = plt.subplot(1, 1, 1)
ax.set_rasterization_zorder(0)
# red point, no border
ax.plot(0, 0, linestyle='none', marker='o', markersize=100,
markerfacecolor='r', markeredgecolor='none', zorder=1)
# rasterized green point, black border
ax.plot(1, 0, linestyle='none', marker='o', markersize=100,
markerfacecolor='g', markeredgecolor='k', zorder=-1)
# rasterized blue point, no border
ax.plot(2, 0, linestyle='none', marker='o', markersize=100,
markerfacecolor='b', markeredgecolor='none', zorder=-1)
ax.axis([-0.5, 2.5, -1, 1])
plt.savefig('test.pdf')
Everything works as expected in an interactive window, but the blue point is invisible in the pdf. The only difference between the red point and the blue point is zorder
, and the only difference between the green point and the blue point is markeredgecolor
. The invisibility of the blue point in the pdf therefore seems to be caused by a combination of rasterization and not having an edge.
I discovered this while running some old plotting scripts I wrote when I was using matplotlib 1.3 installed via pip for homebrew python on Mac OS 10.6.8. I'm now using anaconda python for Mac OS 10.9, which comes with matplotlib 1.4.1. I feel like there must be some connection with either the updated matplotlib or the anaconda python distribution (after all, my old scripts used to produce the correct output), but I cannot test this without reverting my entire python installation.
Does anyone know what could be going on here?