Re: [Matplotlib-users] Noob confusion: Pcolor

2009-11-11 Thread Shrividya Ravi
Thanks for your reply, Giorgio. I had a look at the documentation for pcolor
but unfortunately, I can't pick out where I have gone wrong. I have attached
my data array as a txt file. In ipython, I use the 'loadtxt' command to load
the dataset and then assigned the variables x,y, and z to the first, second
and third columns respectively. I then specified the meshgrid X,Y from the x
and y arrays of my data and used pcolor(X,Y,z) to try and plot the color
map.

Thanks a lot!



On Thu, Nov 12, 2009 at 4:36 AM, Giorgio_Luciano
giorgio_luci...@libero.itwrote:

 Can you send and example of the matrix you are using ?
 Are you sure to have specified correct input according to

 http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=pcolor#matplotlib.pyplot.pcolor
 Cheers
 Giorgio

0 0 195.552
-13.2 9 107.092
-13.2 11.6421 158.136
-13.2 14.2842 105.09
-13.2 16.9263 123.106
-13.2 19.5684 133.114
-13.2 22.2105 93.0799
-13.2 24.8526 91.0782
-13.2 27.4947 83.0713
-13.2 30.1368 89.0765
-13.2 32.7789 97.0834
-13.2 35.4211 89.0765
-13.2 38.0632 93.0799
-13.2 40.7053 92.0791
-13.2 43.3474 86.0739
-13.2 45.9895 90.0773
-13.2 48.6316 89.0765
-13.2 51.2737 89.0765
-13.2 53.9158 88.0756
-13.2 56.5579 89.0765
-13.2 59.2 81.0696
-10.3895 9 107.092
-10.3895 11.6421 111.095
-10.3895 14.2842 123.106
-10.3895 16.9263 136.117
-10.3895 19.5684 133.114
-10.3895 22.2105 98.0842
-10.3895 24.8526 94.0808
-10.3895 27.4947 96.0825
-10.3895 30.1368 93.0799
-10.3895 32.7789 86.0739
-10.3895 35.4211 91.0782
-10.3895 38.0632 93.0799
-10.3895 40.7053 92.0791
-10.3895 43.3474 82.0705
-10.3895 45.9895 83.0713
-10.3895 48.6316 91.0782
-10.3895 51.2737 97.0834
-10.3895 53.9158 94.0808
-10.3895 56.5579 108.093
-10.3895 59.2 88.0756
-7.57895 9 81.0696
-7.57895 11.6421 83.0713
-7.57895 14.2842 89.0765
-7.57895 16.9263 93.0799
-7.57895 19.5684 87.0748
-7.57895 22.2105 100.086
-7.57895 24.8526 83.0713
-7.57895 27.4947 96.0825
-7.57895 30.1368 85.073
-7.57895 32.7789 94.0808
-7.57895 35.4211 87.0748
-7.57895 38.0632 87.0748
-7.57895 40.7053 100.086
-7.57895 43.3474 94.0808
-7.57895 45.9895 89.0765
-7.57895 48.6316 89.0765
-7.57895 51.2737 98.0842
-7.57895 53.9158 86.0739
-7.57895 56.5579 94.0808
-7.57895 59.2 87.0748
-4.76842 9 92.0791
-4.76842 11.6421 86.0739
-4.76842 14.2842 93.0799
-4.76842 16.9263 89.0765
-4.76842 19.5684 85.073
-4.76842 22.2105 97.0834
-4.76842 24.8526 84.0722
-4.76842 27.4947 98.0842
-4.76842 30.1368 93.0799
-4.76842 32.7789 89.0765
-4.76842 35.4211 79.0679
-4.76842 38.0632 96.0825
-4.76842 40.7053 97.0834
-4.76842 43.3474 91.0782
-4.76842 45.9895 86.0739
-4.76842 48.6316 82.0705
-4.76842 51.2737 104.089
-4.76842 53.9158 100.086
-4.76842 56.5579 97.0834
-4.76842 59.2 91.0782
-1.95789 9 102.088
-1.95789 11.6421 82.0705
-1.95789 14.2842 101.087
-1.95789 16.9263 95.0816
-1.95789 19.5684 82.0705
-1.95789 22.2105 89.0765
-1.95789 24.8526 92.0791
-1.95789 27.4947 103.089
-1.95789 30.1368 85.073
-1.95789 32.7789 81.0696
-1.95789 35.4211 96.0825
-1.95789 38.0632 85.073
-1.95789 40.7053 94.0808
-1.95789 43.3474 85.073
-1.95789 45.9895 94.0808
-1.95789 48.6316 91.0782
-1.95789 51.2737 93.0799
-1.95789 53.9158 87.0748
-1.95789 56.5579 109.094
-1.95789 59.2 90.0773
0.852632 9 103.089
0.852632 11.6421 89.0765
0.852632 14.2842 84.0722
0.852632 16.9263 95.0816
0.852632 19.5684 95.0816
0.852632 22.2105 86.0739
0.852632 24.8526 91.0782
0.852632 27.4947 96.0825
0.852632 30.1368 87.0748
0.852632 32.7789 95.0816
0.852632 35.4211 98.0842
0.852632 38.0632 92.0791
0.852632 40.7053 88.0756
0.852632 43.3474 85.073
0.852632 45.9895 93.0799
0.852632 48.6316 84.0722
0.852632 51.2737 89.0765
0.852632 53.9158 78.067
0.852632 56.5579 100.086
0.852632 59.2 96.0825
3.66316 9 83.0713
3.66316 11.6421 94.0808
3.66316 14.2842 91.0782
3.66316 16.9263 85.073
3.66316 19.5684 90.0773
3.66316 22.2105 90.0773
3.66316 24.8526 81.0696
3.66316 27.4947 94.0808
3.66316 30.1368 100.086
3.66316 32.7789 92.0791
3.66316 35.4211 85.073
3.66316 38.0632 100.086
3.66316 40.7053 92.0791
3.66316 43.3474 80.0687
3.66316 45.9895 91.0782
3.66316 48.6316 88.0756
3.66316 51.2737 94.0808
3.66316 53.9158 96.0825
3.66316 56.5579 86.0739
3.66316 59.2 92.0791
6.47368 9 97.0834
6.47368 11.6421 104.089
6.47368 14.2842 80.0687
6.47368 16.9263 87.0748
6.47368 19.5684 118.101
6.47368 22.2105 120.103
6.47368 24.8526 86.0739
6.47368 27.4947 91.0782
6.47368 30.1368 81.0696
6.47368 32.7789 90.0773
6.47368 35.4211 84.0722
6.47368 38.0632 90.0773
6.47368 40.7053 83.0713
6.47368 43.3474 87.0748
6.47368 45.9895 92.0791
6.47368 48.6316 97.0834
6.47368 51.2737 91.0782
6.47368 53.9158 91.0782
6.47368 56.5579 96.0825
6.47368 59.2 103.089
9.28421 9 104.089
9.28421 11.6421 104.089
9.28421 14.2842 117.101
9.28421 16.9263 93.0799
9.28421 19.5684 106.091
9.28421 22.2105 97.0834
9.28421 24.8526 96.0825
9.28421 27.4947 94.0808
9.28421 30.1368 89.0765
9.28421 32.7789 89.0765
9.28421 35.4211 97.0834
9.28421 38.0632 84.0722
9.28421 40.7053 91.0782
9.28421 43.3474 88.0756
9.28421 45.9895 95.0816
9.28421 48.6316 

Re: [Matplotlib-users] Noob confusion: Pcolor

2009-11-11 Thread John Hunter
On Wed, Nov 11, 2009 at 3:22 PM, Shrividya Ravi penthesel...@gmail.com wrote:
 Thanks for your reply, Giorgio. I had a look at the documentation for pcolor
 but unfortunately, I can't pick out where I have gone wrong. I have attached
 my data array as a txt file. In ipython, I use the 'loadtxt' command to load
 the dataset and then assigned the variables x,y, and z to the first, second
 and third columns respectively. I then specified the meshgrid X,Y from the x
 and y arrays of my data and used pcolor(X,Y,z) to try and plot the color
 map.

You have to interpolate your 1D data onto a 2D grid --

# first load the data
In [504]: x,y,z = np.loadtxt('195pt52_T6.txt', unpack=True)

# create evenly sampled x and y vectors to interpolate onto
In [505]: xi = np.linspace(x.min(), x.max(), 20)

In [506]: yi = np.linspace(y.min(), y.max(), 20)

# use griddata to do the 2D interoplation
In [507]: Z = mlab.griddata(x, y, z, xi, yi)

In [508]: Z.shape
Out[508]: (20, 20)

# use meshgrid to create 2D grids of your 1D x and 1 data
In [509]: X, Y = np.meshgrid(xi, yi)

# pass all the 2D arrays to pcolor
In [510]: pcolor(X, Y, Z)
Out[510]: matplotlib.collections.PolyCollection object at 0x113e6d8c



Hope this helps!

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Noob confusion: Pcolor

2009-11-11 Thread Pauli Virtanen
Tue, 10 Nov 2009 23:45:10 -0800, shriv wrote:
 I am a very new user to both python and matplotlib so please beware that
 my questions might be a real no-brainer. Here goes: I have a 3D array of
 data that I isolated from a much larger dataset. The first two columns
 are the x and y positions while the third is the intensity at the
 position (xi, yi). I would like to produce a colour map of the intensity
 as a function of x and y positions. Numerous tries with pcolor have got
 me nowhere. I constantly get an error message saying Too many indices.

You need to regrid your data on a regular grid, not at scattered
positions. See 

http://matplotlib.sourceforge.net/api/mlab_api.html#matplotlib.mlab.griddata

-- 
Pauli Virtanen


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Noob confusion: Pcolor

2009-11-10 Thread shriv

Hi all, 
I am a very new user to both python and matplotlib so please beware that my
questions might be a real no-brainer. Here goes: 
I have a 3D array of data that I isolated from a much larger dataset. The
first two columns are the x and y positions while the third is the intensity
at the position (xi, yi). I would like to produce a colour map of the
intensity as a function of x and y positions. Numerous tries with pcolor
have got me nowhere. I constantly get an error message saying Too many
indices. 

Is my use of pcolor correct? If not, what should I use?

Any help would be greatly appreciated. 

Thanks a lot! :-D

-- 
View this message in context: 
http://old.nabble.com/Noob-confusion%3A-Pcolor-tp26295820p26295820.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users