Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
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

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Jae-Joon Lee
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

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
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

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Jae-Joon Lee
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

Re: [Matplotlib-users] Working with arrows

2009-03-25 Thread Jae-Joon Lee
You need to adjust the keyword arguments, such as head_width, etc. The arrow command itself is poorly documented and its keyword arguments are explained in matplitlib.patches.FancyArrow. However, I recommend you to use annotate command instead of arrow (you can give empty string if you just need an

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
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

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Jae-Joon Lee
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

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Jae-Joon Lee
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

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
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

[Matplotlib-users] Running Python Script from PHP

2009-03-25 Thread sudhir cr
Hello, I am trying to use the matplotlib to generate a histogram and display it on PHP / HTML. The following is the code: abc.py #!/usr/bin/python from pylab import randn, hist x = randn(1) hist(x, 100) testing_python.php www/New_HPD But still am unable to show it on the browser. Can a

[Matplotlib-users] Working with arrows

2009-03-25 Thread Sandro Tosi
Hello, I'm trying to use arrows but I'm a little stuck. In [1]: import matplotlib In [2]: matplotlib.__version__ Out[2]: '0.98.5.3' First, simply import matplotlib.pyplot as plt plt.arrow(2,2,4,1) doesn't show anything, while at least a figure with an arrow in is expected (or it's by design?)

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
> 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

Re: [Matplotlib-users] Trying to plot -- problem with date2num?

2009-03-25 Thread Tyler B
Hi JDH, Thanks for looking into this -- it has been driving me crazy! I tried running your much better code but ended up with the same result: http://screencast.com/t/UMl6l0Y4 I checked and matplotlib is version 0.98.5.2, and your code doesn't using dateutil so I guess that's not it. Any other i

Re: [Matplotlib-users] Trying to plot -- problem with date2num?

2009-03-25 Thread John Hunter
On Wed, Mar 25, 2009 at 3:25 PM, Tyler B wrote: > > And yet here is the result: http://screencast.com/t/gLPDFtwnJM4 > > I can't figure out why the values are 'grouping' around particular values > on the x-axis... I would expect it to look more like a function, with only > one y-value for each x.

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Anthony Floyd
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

[Matplotlib-users] Fwd: Trying to plot -- problem with date2num?

2009-03-25 Thread Tyler B
Sorry to spam.. I was advised to re-send this as plain text. Thanks for any help! Hi there, I'm trying to plot a file which keeps track of my inbox count over time.  Every minute it creates an observation, recording a timestamp, and the inbox count, like this: 2009-03-25 08:33:48, 5 2009-03-25

[Matplotlib-users] Trying to plot -- problem with date2num?

2009-03-25 Thread Tyler B
Hi there, I'm trying to plot a file which keeps track of my inbox count over time. Every minute it creates an observation, recording a timestamp, and the inbox count, like this: 2009-03-25 08:33:48, 5 2009-03-25 08:34:48, 5 2009-03-25 08:35:48, 5 ... and so on. I have about a day's worth of data

Re: [Matplotlib-users] axhline in OO interface?

2009-03-25 Thread Christopher Barker
1st: Sorry about the stupid questions -- I was under a lot of time pressure yesterday. John Hunter wrote: > The search tool on the website is actually pretty decent > > http://matplotlib.sourceforge.net/search.html?q=axhline Yes that is very nice -- I'll make sure to try that in the future.

Re: [Matplotlib-users] problems installing matplotlib

2009-03-25 Thread George B. Myers
Doh! I was misinterpreting what the message meant. So, what it is saying is that it found those things, even libpng, but was then attempting for some reason to make a connection to my X server, and failing because of my convoluted connections. Sigh. I had interpreted that part of the messag

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Christopher Brown
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

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Anthony Floyd
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

Re: [Matplotlib-users] Leftmost column of PNG output is transparent

2009-03-25 Thread Kevin Milner
Maybe I'll try the latest SVN version. I'm running the version in the ubuntu 8.10 repositories, which appears to be 0.98.3 As for both contourf and pcolor, I was just testing to see that it was messed up either way, leaving one commented and one uncommented. Having them both uncommented was jus

Re: [Matplotlib-users] Leftmost column of PNG output is transparent

2009-03-25 Thread Jae-Joon Lee
I couldn't reproduce it (my output has no transparent column). I'm running the current svn. I wonder if others can reproduce it. Kevin, what happen if you only do one of the pcolor or the contourf (it is not clear why you're calling pcolor as it will be overridden by contourf)? -JJ On Mon, Mar

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread Jae-Joon Lee
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

Re: [Matplotlib-users] problems installing matplotlib

2009-03-25 Thread Jouni K . Seppänen
George Myers writes: > However, when I try 2.5.3 for example I am getting the following: The following looks like the script found numpy and freetype just fine: > REQUIRED DEPENDENCIES > numpy: 1.2.1 > freetype2: 9.8.3 But then there was some other problem: > OPT