On Thu, Mar 26, 2009 at 12:19 AM, Jae-Joon Lee wrote:
> Sorry, It's hard to track down what's wrong without actually running the code.
I really appreciate your patience.
> Change
>
> self.legend._loc = loc_in_norm_axes
>
> to
>
> self.legend._loc = tuple(loc_in_norm_axes)
>
> and see if it wor
Sorry, It's hard to track down what's wrong without actually running the code.
Change
self.legend._loc = loc_in_norm_axes
to
self.legend._loc = tuple(loc_in_norm_axes)
and see if it works.
You need to call canvas.draw. However, it will draw whole figure
again. If you're concerned about spee
On Wed, Mar 25, 2009 at 9:58 PM, Jae-Joon Lee wrote:
> Ah, my bad.
>
> Try
>
> self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas)
>
> legend.parent points to the parent axes.
>
> -JJ
>
That cleared up the error, thanks. But it is still not actually moving the
legend. The c
Ah, my bad.
Try
self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas)
legend.parent points to the parent axes.
-JJ
On Wed, Mar 25, 2009 at 9:36 PM, C M wrote:
> On Wed, Mar 25, 2009 at 9:06 PM, Jae-Joon Lee wrote:
>> As I said in my previous email, the _loc attribute of
On Wed, Mar 25, 2009 at 9:06 PM, Jae-Joon Lee wrote:
> As I said in my previous email, the _loc attribute of the legend need
> to be in the normalized axes coordinate, i.e., the lower left corner
> of the axes being (0,0) and the upper-right corner being (1,1). Thus,
> it needs to be something lik
Tony wrote a nice summary of the various coordinate system used in
MPL, but it seems that it didn't make into the official documentation
yet. Here is the link. This will give you some idea about the MPL's
coordinate system.
http://article.gmane.org/gmane.comp.python.matplotlib.general/14008
-JJ
As I said in my previous email, the _loc attribute of the legend need
to be in the normalized axes coordinate, i.e., the lower left corner
of the axes being (0,0) and the upper-right corner being (1,1). Thus,
it needs to be something like below.
loc_in_canvas = self.legend_x + mouse_diff_x, self
Ok, getting there. When I print the various coordinates to stdout, it
SHOULD be working, but my legend is simply disappearing. This
is the stdout on one pixel move with the mouse in the x:
mouse x position at pick time 489
mouse y position at pick time 349.0
Legend x position at pick time = 445
> The event.x and event.y is the position of the mouse, and often this
> would not be the position of the legend (lower left corner) you want.
> I guess a common practice is to calculate how much your mouse moved
> since you started dragging and adjust the position of the legend from
> its original
Hi Che, I think you got bit by the "reply to list" non-feature of this list...
>> In ours, we catch the mpl button down event and after establishing a
>> hit on the legend do:
>
> I was using the pick event, not the button down event. How do you
> "establish a hit on the legend" in the button dow
Hi Che,
There is still a problem with offset, but the legend seems to move the
same distance as the mouse if you get height and width from the axes
instead of the figure:
def on_motion(self, event):
height = float(self.figure.axes[0].bbox.height)
width = float(self.figure
On Tue, Mar 24, 2009 at 11:37 PM, C M wrote:
> Using mpl 0.98.5.2 in OO mode with wxAgg backend.
>
> I'm trying to make my legends draggable. It works, but
> there is a some inaccuracy with positioning. As I drag it,
> the cursor "outruns" the position of the legend, and that
> error grows the f
I don't have wx installed, so i'm not able to test your code.
However, here are some of my thoughts.
The location of the legend is the location of the lower-left corner in
the normalized coordinate of its parent. In your case, it would be
normalized "axes" coordinates. However, it seems that you'r
Using mpl 0.98.5.2 in OO mode with wxAgg backend.
I'm trying to make my legends draggable. It works, but
there is a some inaccuracy with positioning. As I drag it,
the cursor "outruns" the position of the legend, and that
error grows the further away from the initial starting point
the cursor ha
14 matches
Mail list logo