Skip to content

FIX : turn path snapping off on 'o' marker path #4422

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

Merged
merged 2 commits into from
May 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/api/api_changes/2015-05-12_circle_marker_snap.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Changed snap threshold for circle markers to inf
````````````````````````````````````````````````

When drawing circle markers above some marker size (previously 6.0)
the path used to generate the marker was snapped to pixel centers. However,
this ends up distorting the marker away from a circle. By setting the
snap threshold to inf snapping is never done on circles.

This change broke several tests, but is an improvement.
2 changes: 1 addition & 1 deletion lib/matplotlib/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def _half_fill(self):

def _set_circle(self, reduction=1.0):
self._transform = Affine2D().scale(0.5 * reduction)
self._snap_threshold = 6.0
self._snap_threshold = np.inf
fs = self.get_fillstyle()
if not self._half_fill():
self._path = Path.unit_circle()
Expand Down
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/marker_edges.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/matplotlib/tests/baseline_images/test_text/text_contains.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3586,6 +3586,18 @@ def test_set_get_ticklabels():
ax[1].set_yticklabels(ax[0].get_yticklabels() )


@image_comparison(baseline_images=['o_marker_path_snap'], extensions=['png'],
savefig_kwarg={'dpi': 72})
def test_o_marker_path_snap():
fig, ax = plt.subplots()
ax.margins(.1)
for ms in range(1, 15):
ax.plot([1, 2, ], np.ones(2) + ms, 'o', ms=ms)

for ms in np.linspace(1, 10, 25):
ax.plot([3, 4, ], np.ones(2) + ms, 'o', ms=ms)


@cleanup
def test_margins():
# test all ways margins can be called
Expand Down