Skip to content

plot makes strip pattern #16815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Auto-Ken opened this issue Mar 18, 2020 · 2 comments
Closed

plot makes strip pattern #16815

Auto-Ken opened this issue Mar 18, 2020 · 2 comments

Comments

@Auto-Ken
Copy link

Plot function in matplotlib 3.1.3 generate following strips.

ones = np.ones((200,100))
cumsum = np.cumsum(ones, axis=1)
plt.plot(cumsum, linestyle='', marker='o', markersize=0.6, color="k");

200

@timhoffm
Copy link
Member

plot() aligns markers to pixel positions for faster and more clear rendering. Therefore markers may be shifted by fractions of a pixel. If the marker distance is not a multiple of the pixel size, you'll get these artifacts.

Duplicate of #13046 and #7233.

@timhoffm
Copy link
Member

timhoffm commented Mar 18, 2020

A possible workaround is to use scatter() with an array of sizes (with a scalar size and color scatter() would use the same code path as plot()). This comes at the cost of inhomogeneously shaped markers and slower rendering performance.

X, Y = np.meshgrid(np.linspace(0, 1, 200), np.linspace(0, 1, 100))
plt.scatter(X, Y, s=np.full_like(X, 0.6), marker='o',  color="k"); 

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants