Skip to content

Drifted marker positions #8533

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
marko-pi opened this issue Apr 25, 2017 · 5 comments
Closed

Drifted marker positions #8533

marko-pi opened this issue Apr 25, 2017 · 5 comments

Comments

@marko-pi
Copy link

marko-pi commented Apr 25, 2017

Matplotlib draws markers centered around individual pixels of the picture, which means that actual marker coordinates are approximated. This is a considerable problem when smaller resolution plots are required (e.g. creating videos). In particular, markers with slightly different coordinates are displayed on the same position.

For MWE below, all six points have different ordinate values, yet it seems as if points 2,3 and points 4,5,6 have the same value.

bad

MWE:

import matplotlib
from matplotlib import pyplot as plt

coor = [[0.5,0.525,0.55,0.575,0.6,0.625],[0.5,0.501,0.502,0.503,0.504,0.505]]

fig = plt.figure(figsize=(3.5,3.5))
plts=fig.add_subplot(1,1,1)
fig.subplots_adjust(left=0.01, right=0.99, bottom=0.01, top=0.99, hspace=0, wspace=0)

plts.set_xlim([0,1])
plts.set_ylim([0,1])
plts.get_xaxis().set_visible(False)
plts.get_yaxis().set_visible(False)

grph = plts.scatter(coor[0],coor[1],facecolor='k',marker='o',lw=0,s=25)
fig.savefig('test.png', bbox_inches='tight', dpi=100)

According to my visual experience, about two intermediate steps should be included so that the problem is no longer perceived.

The problem can be worked around by creating larger resolution plots and then downscaling them, which is sometimes a tedious process with bad side effects.

good

This problem was also reported on Stackoverflow:

http://stackoverflow.com/questions/43589568/increase-point-drawing-precision/

Best regards

@phobson
Copy link
Member

phobson commented Apr 25, 2017

@marko-pi could you summarize the stackoverflow question here in case the link goes bad?

Also, could you make more clear what your proposed solution is and provide a more descriptive title for the issue?

@tacaswell
Copy link
Member

This is a duplicate of #7233 which is due to an underlying optimization ('stamping' the markers).

@marko-pi
Copy link
Author

marko-pi commented Apr 25, 2017

@tacaswell I agree, this is the duplicate of #7233, #7262 and possibly others.

Will the third report of the same problem make it more urgent?

@marko-pi marko-pi changed the title Feature request Drifted marker positions Apr 25, 2017
@tacaswell
Copy link
Member

I am unclear if this is a regression or an issue that we have always had an no one noticed.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone May 1, 2017
@anntzer
Copy link
Contributor

anntzer commented May 23, 2017

It is a regression between 1.3 and 1.4 (#7262 (comment)).

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

4 participants