I'm using a PolyCollection to plot data of various sizes. Sometimes the polygons are very small. If they are too small, they don't get plotted at all. I would expect the outline at least to show up so you'd have an idea that some data is there. Is there a a setting to control this?
Here's some code to reproduce the problem:
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
verts = []
for i in range(5):
w = 0.5 * 10**(-i)
xs = [i - w, i - w, i + w, i + w, i - w]
ys = [-w, w, w, -w, -w]
verts.append(list(zip(xs, ys)))
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xlim(-1, 6)
ax.set_ylim(-2, 2)
poly = PolyCollection(verts, lw=5, edgecolor='black', facecolor='gray')
ax.add_collection(poly)
plt.show()
Here's the output. Notice that only three polygons are visible, whereas there should be five.
Edit: I understand I could zoom in to see the others, but I was hoping to see a dot or the outline or something without doing this.
from plot with polycollection disappears when polygons get too small

No comments:
Post a Comment