[Matplotlib-users] duplicating a line object

Slavin, Jonathan jslavin at cfa.harvard.edu
Fri Oct 16 10:10:02 EDT 2015


I have a plot on which I want to plot many points as open circles.  I also
want to include a legend.  The problem is that while a thin marker edge
width works very nicely for the plot, it is difficult to see in the
legend.  My solution, which does work, is to define Line2D objects as proxy
artists and keep all the attributes the same except the mew, which I
increase.  However, this seems error prone: if one changes attributes of
the line, then one has to also make those same changes to the proxy artist
line.  I thought a better solution was to create the proxy artist as a
duplicate (copy) of the line and then change the mew via line.set_mew(n).
However, I haven't been able to figure out how to duplicate a Line2D
object.  I tried copy and deepcopy from the python builtin copy module, but
those didn't work.  Any help on this (including alternative ways of
approaching the problem) would be appreciated.


Jonathan D. Slavin                 Harvard-Smithsonian CfA
jslavin at cfa.harvard.edu       60 Garden Street, MS 83
phone: (617) 496-7981       Cambridge, MA 02138-1516
cell: (781) 363-0035             USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20151016/cf804d72/attachment.html>

More information about the Matplotlib-users mailing list