Re: [Matplotlib-users] Cursor corruption with pyqt4 and a work-around.

2010-06-17 Thread sathish kumar
Thanks Mr.David,

I too developing an application using PyQt and Matplotlib. Though I may not
use cursor  for my application, It will keeps me the aware of the things.

With Thanks
Sathishkumar

On Fri, Jun 18, 2010 at 8:34 AM, David Smith wrote:

> I have been developing an application using PyQt ant Matplotlib and
> encountered
> a problem with the mouse cursor shape being incorrect.  I found a
> work-around
> that seems to work, but I think this is a bug and the fix needs to go into
> the
> Matplotlib code base. Here are details.
>
> My application has a central widget used fo r a Matplotlib Figure.
>  Additionally there is a menu bar, button bar and two dock panels with
>  controls for the plot.  I see the following behavior for the cursor:
>
> * On start up, the cursor acts normally on startup provided
>  the mouse cursor is not inside the figure widget on start-up.
>
> * Mouse pointer shapes are set by Windows (in this case VISTA)
>  and change shape according to location.  For example, touching
>  the application window's border results in the arrow pointer
>  changing shape to a double-headed arrow indicating the border
>  can be dragged to adjust the size of the window.
>
> * Once the mouse pointer touches the Matplotlib figure widget
>  in any way, the mouse pointer will cease to show the double-arrow
>  shape on the window borders - the pointer remains an arrowhead.
>  You can still resize the window and the cursor does change to
>  a double-arrow when you press the left button.
>
> My workaround for this was to add the following lines of code in my
> application:
>
>def onleave(self):
>   QtGui.QApplication.restoreOverrideCursor()
>
>self.fig.canvas.mpl_connect('figure_leave_event',  onleave)
>
> I guessed these lines by studying the matplotlib code.  Probably they
> need to go somewhere inside the Matplotlib class definitions.
>
> I hope this helps developers to correct this problem.  My application
> code is medium-large and I didn't try to build a smaller example.  The
> mysterious 3-line workaround solves my problem for the moment.
> Perhaps it will help another PyQt and Matplotlib user and perhaps
> urge developers to fix the problem in the Matplotlib core.
>
> David Smith
>
>
> --
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Cursor corruption with pyqt4 and a work-around.

2010-06-17 Thread David Smith
I have been developing an application using PyQt ant Matplotlib and encountered
a problem with the mouse cursor shape being incorrect.  I found a work-around
that seems to work, but I think this is a bug and the fix needs to go into the
Matplotlib code base. Here are details.

My application has a central widget used fo r a Matplotlib Figure.
 Additionally there is a menu bar, button bar and two dock panels with
 controls for the plot.  I see the following behavior for the cursor:

* On start up, the cursor acts normally on startup provided
  the mouse cursor is not inside the figure widget on start-up.

* Mouse pointer shapes are set by Windows (in this case VISTA)
  and change shape according to location.  For example, touching
  the application window's border results in the arrow pointer
  changing shape to a double-headed arrow indicating the border
  can be dragged to adjust the size of the window.

* Once the mouse pointer touches the Matplotlib figure widget
  in any way, the mouse pointer will cease to show the double-arrow
  shape on the window borders - the pointer remains an arrowhead.
  You can still resize the window and the cursor does change to
  a double-arrow when you press the left button.

My workaround for this was to add the following lines of code in my
application:

def onleave(self):
   QtGui.QApplication.restoreOverrideCursor()

self.fig.canvas.mpl_connect('figure_leave_event',  onleave)

I guessed these lines by studying the matplotlib code.  Probably they
need to go somewhere inside the Matplotlib class definitions.

I hope this helps developers to correct this problem.  My application
code is medium-large and I didn't try to build a smaller example.  The
mysterious 3-line workaround solves my problem for the moment.
Perhaps it will help another PyQt and Matplotlib user and perhaps
urge developers to fix the problem in the Matplotlib core.

David Smith

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting dates and dtypes

2010-06-17 Thread Bill Eaton
I'm struggling to figure out how to format my data so that I can use dates
as x-data. 

I've tried the pylab examples and they execute beautifully on my Windoze and
Linux boxes. But when I try to plot data on my own, it doesn't work. 

Using api example date_demo.py as a starting point. This appears to be stock
price for Google from 2004 to 2008. Here are some clues:

 In [7]: q = np.load(datafile)
 In [8]: q
 Out[7]:
rec.array([ (datetime.date(2004, 8, 19), 100.0, 104.06, 95.954,
100.
34, 22351900L, 100.34),
   (datetime.date(2004, 8, 20), 101.010001, 109.08, 100.5,
108.31, 1
1428600L, 108.31),
   (datetime.date(2004, 8, 23), 110.75, 113.48, 109.05,
109.41,
9137200L, 109.41),
   ...,
   (datetime.date(2008, 10, 10), 313.160003, 341.88,
310
.31, 332.0, 10597800L, 332.0),
   (datetime.date(2008, 10, 13), 355.790002, 381.94,
345
.75, 381.019998, 8905500L, 381.019998),
   (datetime.date(2008, 10, 14), 393.529997, 394.5, 357.0,
362.70999
8, 7784800L, 362.709998)],
  dtype=[('date', '|O4'), ('', '|V4'), ('open', '

This makes me think I don't quite have everything formatted correctly. Any
ideas?

Bill Eaton



--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Placing images on figures

2010-06-17 Thread Eamon Caddigan
On Wed, Jun 16, 2010 at 4:06 PM, Malte Dik  wrote:
> Hi,
>
> Eamon Caddigan 
>> The reason my initial attempts failed was because I (erroneously)
>> assumed that the default axis spanned (0, 0), (1, 1). Now I that I
>> know better, I can place an axis for each image in the right place and
>> everything looks fine.
>>
>> However, I'm still interested in knowing how to query the pixel size
>> of the figure, so I can translate normalized axis coordinates to pixel
>> coordinates.
>
> http://matplotlib.sourceforge.net/users/transforms_tutorial.html
>
> Maybe something along the lines
> ax.transAxes.transform((0, 0)) - ax.transAxes.transform((1, 1))

transAxes.transform() was exactly what I was looking for. Thanks!

-Eamon

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] turning off tick marks

2010-06-17 Thread Eric Firing
On 06/17/2010 07:35 AM, Ryan May wrote:
> On Thu, Jun 17, 2010 at 11:39 AM, Benjamin Root  wrote:
>> Try "ax.set_xticks([])", I think that works for 2D plots.
>
> Nope, labels disappear.
>
> Jeff, try this:
>
> ax.xaxis.set_ticks_position('none')
>
> Ryan
>

In [1]:plot([1,2])
Out[1]:[]

In [2]:ax = gca()

In [3]:for t in ax.xaxis.get_ticklines(): t.set_visible(False)
...:

In [4]:draw()


--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hist() and masked_array

2010-06-17 Thread Eric Firing
On 06/17/2010 05:52 AM, Ryan May wrote:
> On Thu, Jun 17, 2010 at 10:52 AM, Andreas Hilboll  wrote:
>> Hi there,
>>
>> I just noticed today that when I call hist() on a masked_array, also those
>> values which are masked out are displayed (with their fill_value). Is that
>> really the desired behaviour?
>>
>> I'm working in an environment where we're mostly using masked_array, but
>> also sometimes the 'normal' ndarray. So I would need to do something like
>>
>> try:
>>   data = data.compressed()
>> except:
>>   pass
>> hist(data)
>>
>> all the time ... Is there any easier solution?
>
> Unfortunately, these lines in Axes.hist():
>
>  # TODO: support masked arrays;
>  x = np.asarray(x)
>
> say it all. I think changing to asanyarray() should work (I'm not sure
> what, if anything, this would break), but there's no way for you to
> get this behavior without editing your local copy of axes.py.

It takes considerably more than that.  Nothing terribly difficult, but 
more than a couple lines.

Eric

>
> Ryan
>


--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] turning off tick marks

2010-06-17 Thread Ryan May
On Thu, Jun 17, 2010 at 11:39 AM, Benjamin Root  wrote:
> Try "ax.set_xticks([])", I think that works for 2D plots.

Nope, labels disappear.

Jeff, try this:

ax.xaxis.set_ticks_position('none')

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to make 3-D axes/grid more visible?

2010-06-17 Thread Jonathan Slavin
I've been using Axes3D to make plots and I like the output very much --
with the one exception being the faintness of the 3-D grid that is put
in the background.  The light gray used is quite difficult to see.  Is
there some way to specify the color of the grid and/or background?  I'd
be satisfied with having the grid lines darker.  I've been looking
through the axes3d.py file under mpl_toolkits/mplot3d but haven't
figured it out yet.

By the way, anyone looking to specify an initial non-default orientation
for the grid, I discovered that you can do this when instantiating your
Axes3D object this way:
ax = Axes3D(fig,elev=e,azim=a)
where e and a are the elevation about the x-axis and azimuthal rotation
about the z-axis (both in degrees).  0 azimuthal rotation has the y-z
plane in the plane of the screen; azim. rotation is defined as clockwise
as viewed from above.


--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] turning off tick marks

2010-06-17 Thread Benjamin Root
Try "ax.set_xticks([])", I think that works for 2D plots.

Ben Root

On Thu, Jun 17, 2010 at 11:22 AM, Jeff Perry  wrote:

> can someone tell me how to turn off the tick marks on my plot?
>
> i tried this
>
>[line.set_marker('None') for line in ax.get_xticklines()]
>
> but this turns off the labels too.  i don't want to turn off the
> labels, just the tick marks.
>
> someone also suggested this
>
>   ax.xaxis.set_major_locator(pylab.NullLocator())
>
> but it also turns off the labels
>
>
> --
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] turning off tick marks

2010-06-17 Thread Jeff Perry
can someone tell me how to turn off the tick marks on my plot?

i tried this

[line.set_marker('None') for line in ax.get_xticklines()]

but this turns off the labels too.  i don't want to turn off the
labels, just the tick marks.

someone also suggested this

   ax.xaxis.set_major_locator(pylab.NullLocator())

but it also turns off the labels

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hist() and masked_array

2010-06-17 Thread Ryan May
On Thu, Jun 17, 2010 at 10:52 AM, Andreas Hilboll  wrote:
> Hi there,
>
> I just noticed today that when I call hist() on a masked_array, also those
> values which are masked out are displayed (with their fill_value). Is that
> really the desired behaviour?
>
> I'm working in an environment where we're mostly using masked_array, but
> also sometimes the 'normal' ndarray. So I would need to do something like
>
> try:
>  data = data.compressed()
> except:
>  pass
> hist(data)
>
> all the time ... Is there any easier solution?

Unfortunately, these lines in Axes.hist():

# TODO: support masked arrays;
x = np.asarray(x)

say it all. I think changing to asanyarray() should work (I'm not sure
what, if anything, this would break), but there's no way for you to
get this behavior without editing your local copy of axes.py.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] howto turn off colorbar frame

2010-06-17 Thread Jae-Joon Lee
>
> The following gets it done, however:
>
> cb.ax.artists.remove(cb.outline)
>

or

 cb.outline.remove()

-JJ

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hist() and masked_array

2010-06-17 Thread Andreas Hilboll
Hi there,

I just noticed today that when I call hist() on a masked_array, also those
values which are masked out are displayed (with their fill_value). Is that
really the desired behaviour?

I'm working in an environment where we're mostly using masked_array, but
also sometimes the 'normal' ndarray. So I would need to do something like

try:
  data = data.compressed()
except:
  pass
hist(data)

all the time ... Is there any easier solution?

Cheers,

Andreas.


--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] howto turn off colorbar frame

2010-06-17 Thread Ryan May
On Thu, Jun 17, 2010 at 10:29 AM, Jeff Perry  wrote:
> can someone tell me how to turn off the frame on the colorbar?
>
> i tried this
>
> ...
> cb=plt.colorbar()
> plt.axes(cb.ax)
> plt.box(on=False)

There's no function or parameter to control this at the moment
unfortunately (I've marked this as a TODO, but I don't see a quick way
to add it at the moment).

The following gets it done, however:

cb.ax.artists.remove(cb.outline)

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] howto turn off colorbar frame

2010-06-17 Thread Jeff Perry
can someone tell me how to turn off the frame on the colorbar?

i tried this

...
cb=plt.colorbar()
plt.axes(cb.ax)
plt.box(on=False)
...

but it has no effect

thanks,
jeff
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] color in plot3d

2010-06-17 Thread Pablo Angulo
Thanks again!

El 17/06/10 02:03, Mike Alger escribió:
>
> Pablo,
>
>  
>
> I found the example on the svn
>   
> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/mplot3d/surface3d_demo3.py?view=log
> it will demonstrate the face colour thing  but personally I found
> getting the rgb tuple data into an array a bit too complicated for my
> needs.
>
>  
>
> Regarding that little SNAFU about the matrix size, I was half asleep
> and in a rush when I wrote the reply to your email, so I knew if I
> made a mistake it was in the interpretation there :D
>
> A slice,  reshape function  may be more efficient/ easier to read but
> I took the loop structure right from the plot surface command  to make
> sure it was done exactly the same way as the 3d surface. It may be
> interesting to see which is more efficient computationally and  see if
> there is an improvement to be made in the plot surface command
>
>  
>
>  
>
> *From:* Pablo Angulo [mailto:pablo.ang...@uam.es]
> *Sent:* June-16-10 9:07 AM
> *To:* Mike Alger
> *Cc:* matplotlib-users@lists.sourceforge.net
> *Subject:* Re: [Matplotlib-users] color in plot3d
>
>  
>
> El 15/06/10 01:22, Mike Alger escribió:
>
> The way that color keyword is set up,  it is dedsigned to take a color
> word or  rgba tuple , (Reinier will know this better than me), however
> if you want to just assign colors based on a colour map you can take
> you color array  and reshape  the same way the plot surface command
> does  then  use surf.set_array()
>
>
> If I understand you correctly, you mean there is a way to use directly
> a map from two or three spatial coordinates into the three or four
> components of the color space?
>
> That's interesting. It might be limiting that this map has to factor
> as the composition of an scalar map and a color map, even for 2d plots.
>
>
>
>  here is a snippet of the code I use to do this I am pretty sure it
> won’t run the way it is right now but the idea is buried in there
>
> Thanks, I got the idea!
>
>  
>
> note that regmap xyz and costmapz are all the same size and are nxm
> matrices costmapout is a 2x(m.n) if i can do the math correctly
>
>
> One comment: from your code it seems that costmapout is a 1D array of
> lenght roughly equal (m*n)/scale**2 with the data coming from
> costmapz. Why don't you use a slice followed by a reshape command?
>
>  
>
>
>
>
>  
>
>  
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.829 / Virus Database: 271.1.1/2942 - Release Date:
> 06/16/10 14:35:00
>
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Demo does not work on Snow Leopard

2010-06-17 Thread Hana Sevcikova
Hi,

I installed matplotlib-0.99.3-py2.6-macosx10.6.dmg on MacOS X 10.6.3, 
python 2.6.5. But I get an error when running the histogram example from
http://matplotlib.sourceforge.net/examples/api/histogram_demo.html

Exception in Tkinter callback
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py",
 
line 1410, in __call__
 return self.func(*args)
   File 
"/Library/Python/2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 
212, in resize
 self.show()
   File 
"/Library/Python/2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 
216, in draw
 tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
   File 
"/Library/Python/2.6/site-packages/matplotlib/backends/tkagg.py", line 
19, in blit
 tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, 
id(bbox_array))
TclError

Would anybody know what's wrong?

Thanks,

Hana



--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users