[Matplotlib-users] Subplot size

2008-06-13 Thread Anton Fedorov
Hello, matplotlib-users.

  Hi! I'm using matplotlib to display dynamic graph of incoming data.
  Separate window with embedded graph in it.
  Everything okay, except of too much, or too less space available for
graph data, since it passed as percentage. For my case better to say
that 20px from left and 20px from bottom are for axes, everything
other is graph data. Is that possible with matplotlib? Or only handle
resize request and update percentage as needed?

-- 
Best regards,
  Anton
  Call2Ru Service
  [EMAIL PROTECTED]


pgpVk0q1YfXKT.pgp
Description: PGP signature
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread John Hunter
On Thu, Jun 12, 2008 at 9:21 PM, James A. Benson
<[EMAIL PROTECTED]> wrote:
>
>   My app uses the wx backend, so I happened to notice
> that the backend_wx doesn't seem to work with
> matplotlib 0.98.0. Running the 0.98 example embedding_in_wx.py
> shows the problem. Only a bit of the lines get plotted. The
> pan up/down zoom in/out all show various error messages.
> When i revert back to 0.91.3 and run the same 0.91 example
> it works fine.

Hey James, we were discussing problems with the wx backend on 0.98
yesterday on the devel list, and Ken offered to take a look at them,
so it is possible we will have those fixed for the next bugfix
release.  What wx version are you using?

Note that unless you are running over an x11 connection, there is
little reason to prefer wx over wxagg, which has better rendering and
more features.  Over an x11 connection, wxagg is slow because it has
to pass the who bitmap over the wire, but otherwise it works great.

JDH

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Consist Symbols/Sizes between Plot/Scatter

2008-06-13 Thread John Hunter
On Thu, Jun 12, 2008 at 8:56 PM, T J <[EMAIL PROTECTED]> wrote:
> I am making a scatter plot and want the legend to display the symbols.
>  This functionality doesn't seem to exist, so I have followed the
> workaround outlined here:
>
> http://www.nabble.com/Legend-for-a-scatter-plot-based-on-symbols-td17554839.html#a17554839
>
> Are there any plans to make the symbols which are available in plot()
> the same as those available for scatter()?  If not, can we at least
> get the diamond symbol the same?  I want to pass the same symbol to
> plot() and scatter() and get the same symbol---as it is, I must use
> 'd' in scatter and 'D' in plot.

I think this is worth fixing -- could you file a bug on the
sourceforge site and note any symbols you are aware of that don't
agree between plot and scatter.

>
> Also, how are the markersizes scaled? For example, in scatter(), I am
> using s=30...but if I do plot(...,markersize=30), then the markers are
> not the same size as the markers from the scatter plot.  I can go back
> and forth until the scale is right, but is there a better way?

Note sure if this is a bug or a feature, but it is a consequence of
emulating the matlab approach.  In scatter, the size  often is used to
convey information, and the size parameter give thes area of the
circle that circumscribes the marker.  In plot, he marker size is not
generally intended to convey information, only that something happened
here, and the size choice is usually one of aesthetics.   In any case,
in plot the size is radius of the circle, the side of the square or
diamond.  For most markers, you should be able to square the
markersize to get approximate correspondence between plot and scatter.

JDH

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Newbie trying to install matplotlib on OS10.5

2008-06-13 Thread John Hunter
On Fri, Jun 13, 2008 at 2:43 AM, Dan Murphy <[EMAIL PROTECTED]> wrote:

 import scipy
 scipy.test('1','10')
> gave me this
> Traceback (most recent call last):

> ImportError: Need nose >=0.10 for tests - see

This is just an error in the testing framework.  Apparently you need
to upgrade to nose 0.1 to run the tests.  It looks like scipy built
and installed correctly since you could import it.  If you want to run
the tests, go ahead and upgrade nose, but it is not essential.
> Any thoughts? Since scipy did not seem to install correctly, I did not move
> on to the matplotlib step. Can I move on to matplotlib without scipy?

Sorry I wasn't clear.  This installation page is for building a
standard set of tools (MINS - matplotlib, ipython, numpy, scipy) we
use in a course we teach on scientific computing in python.
matplotlib does not require ipython or scipy (but you'll be glad you
have them!).  You can proceed with the matplotlib build instructions.

JDH

PS, please always keep your replies on list rather than just replying to me.

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pie chart lables

2008-06-13 Thread John Hunter
On Fri, Jun 13, 2008 at 5:24 AM, Jatinder Syali <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am trying to create pie chart using matplotlib. I have 9 items to be
> plotted in the chart. sometimes the length of the lable appears to be long
> which scatteres them in the chart. Is there any way to create a link/line
> between label and its pie to make the represenation meaningfull and obvi

Someone recently posted a patch to use left or right alignment of text
depending on which side of he pie you are on.  I think Michael was
going to commit that if noone objected, and it seems like a good idea
to me.  That will probably help.  The main poblem I see  problem in
your example is the labeldistance is too large, try 1.1 or 0.9 and see
if that helps.

JDH

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Michael Droettboom
Sorry I'm just getting into this discussion now.

The wx backend in 0.98 is almost a complete rewrite to use 
wx.GraphicsContext rather than the older wx.DC interface.  It was no 
longer possible to move forward with the new rendering infrastructure 
with the wx.DC interface due to lack of support for polycurves.  As the 
wx backend is one of the least used, perhaps, it hasn't seen the same 
amount of testing as the others and you're running into the bleeding 
edge.  (And some of us still insert an implicit "beta" everytime we see 
the number 0.98... ;)

Note that in my testing, the new wx backend isn't any faster than wxagg 
over an X11 connection, and locally it's *insanely* slow.  On Linux it 
uses Cairo, which has the same bitmap transferring issues that Agg has.  
So that eliminates any advantages it may have had.  Possibly if one were 
doing some wx.GraphicsContext rendering interleaved with matplotlib 
rendering it might be useful, but I doubt there's any of that in the 
wild.  I would strongly suggest we just remove the wx backend at this 
point and move to wxAgg for everything.  I advocated this months ago, 
but forgot to follow through on it --->

http://sourceforge.net/mailarchive/message.php?msg_id=4734927C.3060601%40stsci.edu

Local:
WxAgg: 27.5 fps
Wx: 1.8 fps
Wx: 16.8 fps (without clipping)

Network (X11 with compression):
WxAgg: 2.0 fps
Wx: 1.7 fps
Wx: 2.0 fps (without clipping)

Cheers,
Mike

John Hunter wrote:
> On Thu, Jun 12, 2008 at 9:21 PM, James A. Benson
> <[EMAIL PROTECTED]> wrote:
>   
>>   My app uses the wx backend, so I happened to notice
>> that the backend_wx doesn't seem to work with
>> matplotlib 0.98.0. Running the 0.98 example embedding_in_wx.py
>> shows the problem. Only a bit of the lines get plotted. The
>> pan up/down zoom in/out all show various error messages.
>> When i revert back to 0.91.3 and run the same 0.91 example
>> it works fine.
>> 
>
> Hey James, we were discussing problems with the wx backend on 0.98
> yesterday on the devel list, and Ken offered to take a look at them,
> so it is possible we will have those fixed for the next bugfix
> release.  What wx version are you using?
>
> Note that unless you are running over an x11 connection, there is
> little reason to prefer wx over wxagg, which has better rendering and
> more features.  Over an x11 connection, wxagg is slow because it has
> to pass the who bitmap over the wire, but otherwise it works great.
>
> JDH
>
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Stan West
For what it's worth, the WX backend isn't working for me with wxPython
2.8.4; I get the following when I attempt to show a figure:

  File "C:\Program
Files\Python25\lib\site-packages\matplotlib-0.98.0_r5467-py2.5-win32.egg\mat
plotlib\backends\backend_wx.py", line 474, in select
self.SelectObject(self.bitmap)
AttributeError: GraphicsContextWx instance has no attribute 'SelectObject'

I'm at wxPython 2.8.4 simply because it is included with the Enthought
Python Distribution that I picked for getting started with Python.

However, I don't normally use the WX backend.  I've been using WXAgg, so WX
is relevant for me only for the functionality inherited by WXAgg.

Stan



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Andrea Gavana
Hi Stan,

On Fri, Jun 13, 2008 at 2:09 PM, Stan West wrote:
> For what it's worth, the WX backend isn't working for me with wxPython
> 2.8.4; I get the following when I attempt to show a figure:
>
>  File "C:\Program
> Files\Python25\lib\site-packages\matplotlib-0.98.0_r5467-py2.5-win32.egg\mat
> plotlib\backends\backend_wx.py", line 474, in select
>self.SelectObject(self.bitmap)
> AttributeError: GraphicsContextWx instance has no attribute 'SelectObject'
>
> I'm at wxPython 2.8.4 simply because it is included with the Enthought
> Python Distribution that I picked for getting started with Python.
>
> However, I don't normally use the WX backend.  I've been using WXAgg, so WX
> is relevant for me only for the functionality inherited by WXAgg.

Please upgrade wxPython to the latest release (2.8.7.1) from here:

http://www.wxpython.org/download.php#binaries

Or use the very latest pre-release:

http://wxpython.wxcommunity.com/preview/20080608

This will (probably) fix the problem you see with wx.GraphicsContext,
although I know next to nothing about matplotlib internal handling of
wxPython things.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Michael Droettboom
FWIW, I developed the new wx backend using wx 2.8.6.1, and it does 
currently work for me.  Unfortunately, it's always hard to know how to 
write for a broad range of point releases for wxPython -- the 
documentation offers little clues about when features were added or changed.

Cheers,
Mike

Andrea Gavana wrote:
> Hi Stan,
>
> On Fri, Jun 13, 2008 at 2:09 PM, Stan West wrote:
>   
>> For what it's worth, the WX backend isn't working for me with wxPython
>> 2.8.4; I get the following when I attempt to show a figure:
>>
>>  File "C:\Program
>> Files\Python25\lib\site-packages\matplotlib-0.98.0_r5467-py2.5-win32.egg\mat
>> plotlib\backends\backend_wx.py", line 474, in select
>>self.SelectObject(self.bitmap)
>> AttributeError: GraphicsContextWx instance has no attribute 'SelectObject'
>>
>> I'm at wxPython 2.8.4 simply because it is included with the Enthought
>> Python Distribution that I picked for getting started with Python.
>>
>> However, I don't normally use the WX backend.  I've been using WXAgg, so WX
>> is relevant for me only for the functionality inherited by WXAgg.
>> 
>
> Please upgrade wxPython to the latest release (2.8.7.1) from here:
>
> http://www.wxpython.org/download.php#binaries
>
> Or use the very latest pre-release:
>
> http://wxpython.wxcommunity.com/preview/20080608
>
> This will (probably) fix the problem you see with wx.GraphicsContext,
> although I know next to nothing about matplotlib internal handling of
> wxPython things.
>
> Andrea.
>
> "Imagination Is The Only Weapon In The War Against Reality."
> http://xoomer.alice.it/infinity77/
>
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Andrea Gavana
Hi Michael,

On Fri, Jun 13, 2008 at 2:23 PM, Michael Droettboom wrote:
> FWIW, I developed the new wx backend using wx 2.8.6.1, and it does currently
> work for me.  Unfortunately, it's always hard to know how to write for a
> broad range of point releases for wxPython -- the documentation offers
> little clues about when features were added or changed.

Then it might be possible that something has changed between 2.8.4.0
(the OP wxPython version) and 2.8.6.0 (yours), although it looks like
a wxWidgets difference rather than a wxPython one...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Stan West
Hi, Andrea.  Yes, I bet that upgrading would resolve the issue.  However,
the issue isn't getting in my way at the moment, since I use the WXAgg
backend and it works well as far as I can tell.  I mainly wanted to point
out for informational purposes -- and I may have been unclear about my point
-- that the Enthought Python distribution is currently at wxPython 2.8.4 and
that the WX backend seems not to work at that version.



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] axes labels missing from plot

2008-06-13 Thread Robin
Hi,

I'm not sure if I'm doing something wrong, but I find the sizing of
the axes areas when doing plots a bit problematic.

If I make the figures small, the actual plot area takes up most of the
area and the axes labels aren't visible unless I make the window
bigger. When I export to eps or pdf, they are also cut off.

Is there a way to get the plot area scaled to the figure size in such
a way that the axes labels can be included? I am trying to avoid
having to scale the image when it is included in the document.

Thanks,

Robin

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread James A. Benson
On Fri, 13 Jun 2008, John Hunter wrote:

> On Thu, Jun 12, 2008 at 9:21 PM, James A. Benson
> wrote:
>>
>>   My app uses the wx backend, so I happened to notice
>> that the backend_wx doesn't seem to work with
>> matplotlib 0.98.0. Running the 0.98 example embedding_in_wx.py
>> shows the problem. Only a bit of the lines get plotted. The
>> pan up/down zoom in/out all show various error messages.
>> When i revert back to 0.91.3 and run the same 0.91 example
>> it works fine.
>
> Hey James, we were discussing problems with the wx backend on 0.98
> yesterday on the devel list, and Ken offered to take a look at them,
> so it is possible we will have those fixed for the next bugfix
> release.  What wx version are you using?
>

Sorry, I forgot to include that important detail. I
see the problem on a Linux F8 machine with wx version 2.8.7.1

> Note that unless you are running over an x11 connection, there is
> little reason to prefer wx over wxagg, which has better rendering and
> more features.  Over an x11 connection, wxagg is slow because it has
> to pass the who bitmap over the wire, but otherwise it works great.
>
> JDH
>

Thanks for the advice and later comments on this thread from
Michael. Sounds like i'm definitely doing the right
thing by switching from the wx backend to perhaps any other backend.
I'm going with the qt4 backend.

Thanks,

Jim


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] CocoaAgg backend seems to be broken

2008-06-13 Thread Charlie Moad
 I am out of town and won't be able to address this until early next week.

- Charlie

2008/6/12 John Hunter <[EMAIL PROTECTED]>:

> On Thu, Jun 12, 2008 at 2:58 PM, İsmail Dönmez <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I was trying matplotlib 0.98.0 and Qt4 backend works great but Coca
> > backend seems to be broken :
>
> Charlie,
>
> any chance you can try and port cocoaagg over to the new trunk api.
> figure.dpi is no longer a lazy value, but a plain ol number.  There
> are probably a few other changes that will need to be made as well.
> I'd like to clear up as many of these problems as we can and shoot for
> a bugfix release next week.
>
> JDH
>
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Creating an oceanographic profile with matplotlib

2008-06-13 Thread Oz Nahum
Hi all,

I am trying to plot an oceanographic profile using some ocean data I have.
The thing is that in oceanograhy it is common to display graphs where the
independent variable (x) is depth, and some other data (i.e salinity or
temperature) is plotted against it. The graph is supposed to look like this
for example:

 y
   ___
  |*
  |   *
  |  *  * *
  |*
  |  *
  | *
 x   | *
  |   *
  |*
  | *
  |*
  |  *
  |*
  |  *
  |  *
  |  *


so far I have managed to plot the graph with invert x axis, but I don't know
how to change the default graph option of intercept of axes in the bottom
left corner.
So I hope I made my question clear: how can I plot a graph with intecept of
axes in the upper left corner ?
Thanks,
Oz Nahum,
Department of Oceanography,
Hebrew University, Jerusalem
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Creating an oceanographic profile with matplotlib

2008-06-13 Thread Ryan May
Oz Nahum wrote:
> Hi all,
> 
> I am trying to plot an oceanographic profile using some ocean data I 
> have. The thing is that in oceanograhy it is common to display graphs 
> where the independent variable (x) is depth, and some other data (i.e 
> salinity or temperature) is plotted against it. The graph is supposed to 
> look like this for example:
> 
>  y
>___
>   |*
>   |   *
>   |  *  * *
>   |*
>   |  *
>   | *
>  x   | *
>   |   *
>   |*
>   | *
>   |*
>   |  *
>   |*  
>   |  *
>   |  *
>   |  *
> 
> 
> so far I have managed to plot the graph with invert x axis, but I don't 
> know how to change the default graph option of intercept of axes in the 
> bottom left corner.
> So I hope I made my question clear: how can I plot a graph with intecept 
> of axes in the upper left corner ? 

Try this:

import numpy as np
import matplotlib.pyplot as plt
salinity = np.random.random(50)
depth = np.linspace(1, 500)
plt.plot(salinity, depth)
ax = plt.gca()
ax.set_ylim(500, 0)

Things to note:
1) Matplotlib doesn't care about dependent or independent variables. 
With plot(x,y), one variable gets mapped to the x-axis, one gets mapped 
to the y-axis.
2)ax.set_ylim says that the call is (min,max), but what it really means 
is (lower,upper).  This could probably be clearer in the docs.

HTH,

Ryan

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

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Creating an oceanographic profile with matplotlib

2008-06-13 Thread Abhinav Verma
or more appropriately you might need this

from pylab import *

setp(gca(), 'xticklabels', [])
subplot(111)
ax=twiny()
y = [1, 2, 3, 4]
x = [5, 4, 2, 2]
plot(x, y, 'ro-')
ylim(5,0)
xlim(1,6)
ax.xaxis.tick_top()
xlabel('Y')
ylabel('X')
show()


On Fri, Jun 13, 2008 at 10:24 AM, Oz Nahum <[EMAIL PROTECTED]> wrote:

> Hi all,
>
> I am trying to plot an oceanographic profile using some ocean data I have.
> The thing is that in oceanograhy it is common to display graphs where the
> independent variable (x) is depth, and some other data (i.e salinity or
> temperature) is plotted against it. The graph is supposed to look like this
> for example:
>
>  y
>___
>   |*
>   |   *
>   |  *  * *
>   |*
>   |  *
>   | *
>  x   | *
>   |   *
>   |*
>   | *
>   |*
>   |  *
>   |*
>   |  *
>   |  *
>   |  *
>
>
> so far I have managed to plot the graph with invert x axis, but I don't
> know how to change the default graph option of intercept of axes in the
> bottom left corner.
> So I hope I made my question clear: how can I plot a graph with intecept of
> axes in the upper left corner ?
> Thanks,
> Oz Nahum,
> Department of Oceanography,
> Hebrew University, Jerusalem
>
>
>
>
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Handling data and creating arrays

2008-06-13 Thread washakie

Hello, I've started to use the convention of making dictionaries to hold my
datasets. But I haven't settled on an approach yet, and would like input
from people for how they a) handle their arrays of data, and b) how to
create pylab arrays from lists of lists, etc.

What I generally have is:

DataDict={var1:(x1,y1),var2:(x2,y2),var3:(x3,y3)}  ; where the x and y's are
generally lists.

Now that's nice, because I can cycle through the DataDict.keys() to batch
plot, etc. But how can I convert the whole dict into a single array
(assuming the lengths are all equal)? I would like:

myArray=
x1a,y1a,x2a,y2a,x3a,y3a
x1b,y1b,x2b,y2b,x3b,y3b
...
x1,z,y1z,x2z,y2z,x3z,x3z

Where:
myArray[:,0]= x1a...x1z
myArray[0,:]=x1a,y1a,x2a,y2a,x3a,y3a

and so forth...
Thanks!

-- 
View this message in context: 
http://www.nabble.com/Handling-data-and-creating-arrays-tp17834278p17834278.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Handling data and creating arrays

2008-06-13 Thread Alan G Isaac
On Fri, 13 Jun 2008, washakie apparently wrote:
> DataDict={var1:(x1,y1),var2:(x2,y2),var3:(x3,y3)}  ; where 
> the x and y's are generally lists. 
> Now that's nice, because I can cycle through the DataDict.keys() to batch 
> plot, etc. But how can I convert the whole dict into 
> a single array (assuming the lengths are all equal)?

Perhaps as below?
(Or the transpose.)
Alan Isaac


>>> x1,y1,x2,y2 =np.random.random((4,20))
>>> data = dict(var1=(x1,y1), var2=(x2,y2))
>>> a = np.c_[[d for xy in data.values() for d in xy]]
>>> a
array([[ 0.66613738,  0.39154179,  0.52399694,  0.54694366,  0.52103419,
 0.06023608,  0.03752003,  0.14947236,  0.56515257,  0.03980963,
 0.08809146,  0.27861545,  0.62107655,  0.01718959,  0.40346171,
 0.8438409 ,  0.84710117,  0.49979344,  0.93686618,  0.07087815],
   [ 0.60181235,  0.1171198 ,  0.40210686,  0.12248918,  0.73587718,
 0.82907553,  0.04241232,  0.82834355,  0.89439919,  0.6477373 ,
 0.88697623,  0.12711133,  0.08061116,  0.96609631,  0.69845226,
 0.32363392,  0.05150339,  0.05108155,  0.66766576,  0.93701382],
   [ 0.85075356,  0.12107294,  0.33732861,  0.1564,  0.04249297,
 0.54150883,  0.16414129,  0.93346553,  0.52176851,  0.24449367,
 0.5526363 ,  0.23359769,  0.40763005,  0.62820355,  0.70694987,
 0.51204826,  0.15503887,  0.58975501,  0.32507773,  0.76876558],
   [ 0.54390474,  0.30364361,  0.8469127 ,  0.79118699,  0.88471469,
 0.98490908,  0.03890524,  0.52584869,  0.08669779,  0.42734853,
 0.17571326,  0.33677747,  0.3046382 ,  0.17856421,  0.26186241,
 0.2688219 ,  0.97639377,  0.85320323,  0.84821184,  0.31592768]])
>>>



















































-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Handling data and creating arrays

2008-06-13 Thread Chris.Barker
washakie wrote:
> DataDict={var1:(x1,y1),var2:(x2,y2),var3:(x3,y3)}  ; where the x and y's are
> generally lists.

You might be able to use numpy record arrays (recarray). There are lots 
of good reasons to use numpy arrays other than plotting.

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Handling data and creating arrays

2008-06-13 Thread washakie

Okay?? 

That does seem to work... I guess I'd better go read up on index_tricks.py ? 

Thanks.


Alan G Isaac wrote:
> 
 x1,y1,x2,y2 =np.random.random((4,20))
 data = dict(var1=(x1,y1), var2=(x2,y2))
 a = np.c_[[d for xy in data.values() for d in xy]]
 a
> array([[ 0.66613738,  0.39154179,  0.52399694,  0.54694366,  0.52103419,
>  0.06023608,  0.03752003,  0.14947236,  0.56515257,  0.03980963,
>  0.08809146,  0.27861545,  0.62107655,  0.01718959,  0.40346171,
>  0.8438409 ,  0.84710117,  0.49979344,  0.93686618,  0.07087815],
>[ 0.60181235,  0.1171198 ,  0.40210686,  0.12248918,  0.73587718,
>  0.82907553,  0.04241232,  0.82834355,  0.89439919,  0.6477373 ,
>  0.88697623,  0.12711133,  0.08061116,  0.96609631,  0.69845226,
>  0.32363392,  0.05150339,  0.05108155,  0.66766576,  0.93701382],
>[ 0.85075356,  0.12107294,  0.33732861,  0.1564,  0.04249297,
>  0.54150883,  0.16414129,  0.93346553,  0.52176851,  0.24449367,
>  0.5526363 ,  0.23359769,  0.40763005,  0.62820355,  0.70694987,
>  0.51204826,  0.15503887,  0.58975501,  0.32507773,  0.76876558],
>[ 0.54390474,  0.30364361,  0.8469127 ,  0.79118699,  0.88471469,
>  0.98490908,  0.03890524,  0.52584869,  0.08669779,  0.42734853,
>  0.17571326,  0.33677747,  0.3046382 ,  0.17856421,  0.26186241,
>  0.2688219 ,  0.97639377,  0.85320323,  0.84821184,  0.31592768]])

> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Handling-data-and-creating-arrays-tp17834278p17834620.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Dynamically defining map extents

2008-06-13 Thread washakie

Hello, I've defined the following function to dynamically define map extents
based on lon,lat input data. It is not very elegant or robust, but it does
seem to work. One issue, however, and it probably is related to something
else further down the chain... but every plot ends up being a different
size. So an improvement right off would be able to define a plot size (or at
least ratio, such that the limits would scale to the ratio). I would be
interested in comments on how to improve it.

def map_dynaMap((x,y)):
   """Sets a map region based on input data """
 
   ymin=min(y); ymax=max(y); y_edge=abs(ymax-ymin)*0.35
   xmin=min(x); xmax=max(x); x_edge=abs(xmax-xmin)*0.35

   llcrnrlat= ymin-y_edge
   if llcrnrlat<-90.: llcrnrlat=-90.
   llcrnrlon= xmin-x_edge
   if llcrnrlon<-180.: llcrnrlon=-180.
   urcrnrlat= ymax+y_edge
   if urcrnrlat>90.: urcrnrlat=90.
   urcrnrlon= xmax+x_edge
   if urcrnrlon>180.: urcrnrlon=180.
   area_thresh=1000
   resolution='l'
   projection='aea'
   lat_0=y[int(len(y)/2)]
   lat_1=lat_0-y_edge
   lon_0=x[int(len(x)/2)]
   #lon_1=110.
   rsphere=(6378137.00,6356752.3142)
   pd=y_edge
   md=x_edge
   return
urcrnrlon,urcrnrlat,llcrnrlat,llcrnrlon,pd,md,lat_0,lat_1,lon_0,area_thresh,projection,resolution,rsphere

-- 
View this message in context: 
http://www.nabble.com/Dynamically-defining-map-extents-tp17835230p17835230.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users