Hi,

In a part of my code I use

----
thisline = CL.CustomLine([x1, x2], [y1, y2], color='black', linestyle='--',
picker=2, zorder=20, id=lbl)

self.ax.add_line(thisline)

if (cfg.linedraw_label):
    self.ax.text(x2, y2, lbl, fontname='Sans', fontsize=9, picker=2,
zorder=20)
----

In another part of the code I act on pick events

----
def OnPick(self, event):
        self.picked = event.artist

if isinstance(self.picked, CL.CustomLine):
            if (cfg.select_mode):
                    <SNIP>

            if(cfg.delete_mode):
                self.picked.remove()
                self.canvas.draw()

if isinstance(self.picked, Text):
    if(cfg.delete_mode):
           self.picked.remove()
           self.canvas.draw()
----

Here are my questions:
1. I have extended the Line2D class as I am using _nolegend_ in the label.
I still wanted to differentiate between lines using something called id.  Is
there a better way of doing it with built-in attributes?

2. I can remove the line but somehow the text added to the axes does not
respond to pick events.  Anybody has any thoughts?

3. The neat thing would be to add the text into the CustomLine class so
line's label is contained in the class.  Not sure how I can do it because
text needs an axis and axis is nor associated with Line2D until you add the
line to axis...

4. How can I add a constant offset like (2 pixels right, 2 pixels up) at the
right end of the line for its text label.

Thanks in advance.

Nihat
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to