Bug summary
When passing an empty dataset to ax.scatter() with clip_on=False and a label, calling ax.legend() causes a marker artifact to render incorrectly at the bottom-left edge of the plot. Toggling clip_on=True makes the artifact disappear.
Code for reproduction
import matplotlib.pyplot as plt
import scienceplots
plt.style.use("science")
fig, ax = plt.subplots()
ax.set_xlim(1, 180)
ax.set_ylim(9.90, 10.15)
# Empty scatter with clip_on=False and a legend label
ax.scatter(
[], [],
color="red",
s=50,
facecolors="none",
edgecolors="red",
linewidths=1,
label="Outlier",
clip_on=False
)
ax.legend()
plt.show()
Actual outcome
clip_on=False => artifact in the lower left corner

Expected outcome
clip_on=True => no artifact in the lower left corner
Additional information
Happens also when exporting as pgf and embedding into a Latex document.
Operating system
Arch
Matplotlib Version
3.10.9
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.13.14
Jupyter version
7.6.2
Installation
pixi
Bug summary
When passing an empty dataset to ax.scatter() with clip_on=False and a label, calling ax.legend() causes a marker artifact to render incorrectly at the bottom-left edge of the plot. Toggling clip_on=True makes the artifact disappear.
Code for reproduction
Actual outcome
clip_on=False => artifact in the lower left corner

Expected outcome
clip_on=True => no artifact in the lower left corner
Additional information
Happens also when exporting as pgf and embedding into a Latex document.
Operating system
Arch
Matplotlib Version
3.10.9
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.13.14
Jupyter version
7.6.2
Installation
pixi