Open
Description
Bug summary
Plotting a scatter where c=
is a sequence with the initial value being nan
will have the legend entry showing text only
Code for reproduction
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 1, 50)
y = np.linspace(-1, 1, 50)
c = np.linspace(10, 100, 50)
c_nan = np.linspace(10, 100, 50)
c_nan[0] = np.nan
fig, ax = plt.subplots()
line1 = ax.scatter(x, y, c=c, s=12, label='Test 1')
line2 = ax.scatter(x * 2, y * 2, c=c_nan, s=12, label='Test 2')
ax.legend()
plt.show()
Actual outcome
Expected outcome
Have each legend entry show a symbol
Additional information
No response
Operating system
WIndows
Matplotlib Version
3.6.3
Matplotlib Backend
Qt5Agg
Python version
3.10.x
Jupyter version
No response
Installation
pip