You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importmatplotlib.pyplotaspltfrommatplotlib.patchesimportRectangleimportnumpyasnpxr=np.linspace(-10, 10, 2)
X, Y=np.meshgrid(xr, xr)
# ncols needs to be >= 3 to trigger the problemfig, axes=plt.subplots(nrows=1, ncols=3, sharey=True)
foriax, axinenumerate(axes.flatten()):
ax.set_aspect('equal')
r=Rectangle((X.min(), Y.min()), X.ptp(), Y.ptp(),
color='k', fill=False, ls='--', lw=1)
ax.add_patch(r)
ax.set_xlim(X.min()-1, X.max()+1)
ax.set_ylim(Y.min()-1, Y.max()+1)
plt.savefig('export.pdf')
plt.show()
When saving the above figure to a pdf file, an additional (unwanted) tilted dashed line is drawn on the third axis (=axes[2]). Note that this line is only visible in the generated pdf file and not in the interactive window.
Activity
tacaswell commentedon Jan 31, 2016
The other odd thing is that the x limits are not [-11, 11] like they should be set to...
tacaswell commentedon Jan 31, 2016
and changing the figure size can suppress this issue as well.
tacaswell commentedon Jan 31, 2016
It looks like this is an issue with the clipping, these are the paths for the rectangles from left to right (sorry about my silly variable names).
tacaswell commentedon Jan 31, 2016
Ah, the problem is the trailing 'h' or the second 'm' in the last rectangle. Removing the h or changing the second m -> l fixes the problem.
Fix matplotlib#5948: Don't clip closed paths
Merge pull request #5955 from mdboom/fix-path-line
Fix matplotlib#5948: Don't clip closed paths