Skip to content

Using facecolors='none' with a scatter plot results in off-centered symbols #17790

Description

@stephjuneau

Bug report

Bug summary

Using facecolors='none' with matplotlib.pyplot.scatter(x,y) displays symbols that are offset from their input (x,y) positions. This is a different behavior compared to using, e.g., facecolors='white', in which case the symbols are centered properly on the input (x,y) values.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(8)
y = np.random.rand(8)

fig = plt.figure(figsize=(10,3))
plt.scatter(x,y,marker="o",s=80,facecolors='white',edgecolors='blue')
plt.scatter(x,y,s=2)
plt.scatter(x,y,marker="o",s=140,facecolors='none',edgecolors='red')

Actual outcome

facecolors_bug

Expected outcome

I would expect that the symbols should be properly centered and not offset when using facecolors='none' (red edge color in the example above). We can see on the figure that using facecolors='white' produces properly centered symbols (blue edge color). The red symbols should have the same centers.

Matplotlib version

  • Operating system: Scientific Linux release 6.10
  • Matplotlib version: 3.1.1
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7.4
  • Jupyter version (if applicable): 4.3.0
  • Other libraries: numpy 1.17.2
conda main default channel

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions