Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUGFIX: scatter should draw ',' as a single pixel #17367

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brunobeltran
Copy link
Contributor

@brunobeltran brunobeltran commented May 8, 2020

PR Summary

Attempt to fix #11460.

Instead of adding a special case to PathCollection, which (IMO, and I am happy to be told I'm wrong about this) has no business knowing that the path it's drawing came from a MarkerStyle at all, let alone that it came from the weird, special-case marker ',', I added a kwarg to _CollectionWithSizes that allows one to specify that the self-same sizes should actually just be ignored. With this in place, Axes.scatter (which does know that we are using MarkerStyle) can pass the appropriate Path to PathCollection (of width one) and ask the PathCollection to ignore the scaling information, which is what that particular marker is supposed to do, I think.

WIP because I can't seem to figure out one last little issue, where what appear to be identical inputs are being sent to Agg's draw_marker and producing two different results (off-by-one pixel).

Test Cases

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(0, 0, marker=',')
plt.savefig('plot_single_pixel.png')
fig, ax = plt.subplots()
ax.scatter(0, 0, marker=',', edgecolors='none')
plt.savefig('scatter_single_pixel.png')

Output

(Screenshots from GIMP to make it more clear exactly what the error is)

plot case (correctly one pixel):
pixel-zoom

scatter case currently in master (many pixels...):
unfix-scatter-zoom

scatter case in current PR (almost correct):
fix-scatter-zoom

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@github-actions
Copy link

github-actions bot commented Aug 2, 2023

Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it.

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scatter shows square marker instead of pixel
1 participant