Skip to content

legend marker update bug #2035

Closed
Closed
@gregorio-bastardo

Description

@gregorio-bastardo

When a line object is added to the legend without marker, the update works fine both on data and legend line, but with marker it does not refresh the legend line's marker:


import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
line, = ax.plot(range(10), range(10))

# uncomment next line to reproduce bug
# line.set_marker('d')

legend = ax.legend([line], ['foo'])
legend_line, = legend.get_lines()
fig.show()
raw_input('press enter to clear marker')
line.set_marker('')
legend_line.set_marker('')
fig.canvas.draw()
raw_input('press enter to set marker')
line.set_marker('d')
legend_line.set_marker('d')
fig.canvas.draw()
raw_input('press enter to exit')
 

I understand that lines and markers are drawn separately to support special legend patterns, but this is somehow not the case when line is originally added to the legend without marker. Please align legend line and marker property updates.

python 2.7.4 win32
matplotlib 1.2.1

originally reported on mpl-users:
http://matplotlib.1069221.n5.nabble.com/legend-marker-update-problem-tc41070.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions