We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When edgecolors is not None in ax.scatter, overlapped dots could not align to the center even if dots with the same coordinates
edgecolors
ax.scatter
import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame({'Gene_set': ['2022', '2022', '2022', '2022', '2022', '2021', '2021', '2021', '2021', '2021'], 'Term': ['regulation of cation channel activity (GO:2001257)', 'establishment of mitochondrion localization, microtubule-mediated (GO:0034643)', 'DNA-templated transcription, termination (GO:0006353)', 'mitochondrion transport along microtubule (GO:0047497)', 'mitochondrial fission (GO:0000266)', 'regulation of cation channel activity (GO:2001257)', 'establishment of mitochondrion localization, microtubule-mediated (GO:0034643)', 'DNA-templated transcription, termination (GO:0006353)', 'mitochondrion transport along microtubule (GO:0047497)', 'mitochondrial fission (GO:0000266)'], 'area': [82.83045070066913, 625.0, 66.30612244897958, 260.94674556213016, 177.7777777777778, 82.83045070066913, 625.0, 66.30612244897958, 260.94674556213016, 177.7777777777778], 'p_inv': [2.5549417930429006, 0.7132534017074245, 0.6939727070003071, 0.6939727070003071, 0.6489820335167326, 2.5549417930429006, 0.7132534017074245, 0.6939727070003071, 0.6939727070003071, 0.6489820335167326]}) ## scatters fig, (ax1, ax2) = plt.subplots(2,1, figsize=(4,8)) smax = df["area"].max() x = "Gene_set" y = "Term" blk_sc1 = ax1.scatter( x=x, y=y, s=smax * 1.2, edgecolors="none", c="black", data=df, marker='o', zorder=0) wht_sc1 = ax1.scatter( x=x, y=y, s=smax * 1.0, edgecolors="none", c="white", data=df, marker='o', zorder=1) sc2 = ax1.scatter(x=x, y=y, data=df, s="area", edgecolors="none", c="p_inv", cmap=plt.cm.RdBu, marker="o", zorder=2) ax1.set_title("set edgecolors='none', scatter aligned at center", fontsize=16) ax1.margins(x = 0.25, y = 0.1) ## when set edgecolors, could not align at center blk_sc2 = ax2.scatter( x=x, y=y, s=smax * 1.2, edgecolors="gray", c="white", data=df, marker='o', zorder=0) sc2 = ax2.scatter(x=x, y=y, data=df, s="area", edgecolors="none", c="p_inv", cmap=plt.cm.RdBu, marker="o", zorder=2) ax2.set_title("set edgecolors='gray', scatter not aligned at center", fontsize=16) ax2.margins(x = 0.25, y = 0.1) plt.show()
The actual outcome is the ax2 mentioned above
ax2
The expected outcome should be is the ax1 which mentioned above
ax1
No response
Ubuntu
3.5.2
module://matplotlib_inline.backend_inline
3.10
conda
The text was updated successfully, but these errors were encountered:
This is like due to the draw-as-marker fast-path with does pixel snapping. [sorry for the very terse answer]
Sorry, something went wrong.
@tacaswell , however, the default behavior is not intuitive to a non-expert user like me.
This is essentially the same as #7233 afaict, feel free to comment on that issue.
No branches or pull requests
Bug summary
When
edgecolors
is not None inax.scatter
, overlapped dots could not align to the center even if dots with the same coordinatesCode for reproduction
Actual outcome
The actual outcome is the
ax2
mentioned aboveExpected outcome
The expected outcome should be is the
ax1
which mentioned aboveAdditional information
No response
Operating system
Ubuntu
Matplotlib Version
3.5.2
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.10
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered: