Closed
Description
pylab.plot
is supposed to draw lines and/or markers but it turns out markers aren't independent from lines. Here is an example:
import matplotlib.pylab as plt
marker_size=10
plt.figure()
plt.subplot(221)
plt.plot(
range(10),
linestyle='--',
)
# drawing a line looks fine
plt.subplot(222)
plt.plot(
range(10),
marker='o',
markersize=marker_size,
markeredgewidth=2,
markeredgecolor='r',
)
# drawing markers is a bit problematic. There is always a line associated with markers.
plt.subplot(223)
plt.plot(
range(10),
linestyle=' ',
marker='o',
markersize=marker_size,
markeredgewidth=2,
markeredgecolor='r',
)
# In order to ONLY draw markers, 'linestyle' should be set an empty string.
plt.subplot(224)
plt.plot(
range(10),
linestyle='--',
linewidth=3,
marker='o',
markeredgewidth=2,
markeredgecolor='r',
markersize=marker_size,
)
# It's even more strange that when you do want makers with a line, 'linestyle' also affects marker
# edges. In this example, line is set dashed. Then the marker's edges get dashed too!
plt.draw()
plt.show()
There are of-course ways to get around these problems, but wondering maybe this is a bug unexpected by maintainers.