plot x y value(x,y)

Hi,

this is probably a stupid question, but somehow I just can't figure
out how to do it. I have data given in an array with entries:

x y data(x,y)

and thus of shape (#data points, 3)

what is the easiest way with mpl to plot these data points, susch that
they are located at x,y and colored according to data(xy)?

Thanks for any pointers,
Hanno

···

--
Hanno Klemm
klemm@...948...

Hi,

No stupid question at all! I don't really understand your question, but it
sounds to me like a scatter plot is what you want. In that case, just have a
look at the scatter plot demos on the web page (-> screenshots) or in the
example files.

HTH
Christian

···

On Friday 13 October 2006 14:25, Hanno Klemm wrote:

Hi,

this is probably a stupid question, but somehow I just can't figure
out how to do it. I have data given in an array with entries:

x y data(x,y)

and thus of shape (#data points, 3)

what is the easiest way with mpl to plot these data points, susch that
they are located at x,y and colored according to data(xy)?

Thanks for any pointers,
Hanno

Christian Meesters wrote:

Hi,

No stupid question at all! I don't really understand your question, but it sounds to me like a scatter plot is what you want. In that case, just have a look at the scatter plot demos on the web page (-> screenshots) or in the example files.

HTH
Christian

Actually sounds more like a surface or contour plot. You have x, y, and z where z=function of (x,y). I thought there was a contour call in matplotlib. I'll look.

···

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC 20375
USA
Ph: +202-767-6002
email: pecora@...1125...

Hi Louis,

sorry for being unclear. What I have is a list of data points given in
the format

x y value

so my array looks like

x_1, y_1, v_1
x_2, y_2, v_2,

etc.

Now I want to plot a point at (x_i, y_i) and assign to it a color
according to v_i. The problem is, that the values at x and y are given
and are not calculated.

Christian's suggestion with a scatter plot works fine for me, but if
there are other possibilities I'm always keen to learn something.

Hope this clarifies matters.

Best regards,
Hanno

Louis Pecora <pecora@...1125...> said:

Christian Meesters wrote:
> Hi,
>
> No stupid question at all! I don't really understand your

question, but it

> sounds to me like a scatter plot is what you want. In that case,

just have a

> look at the scatter plot demos on the web page (-> screenshots) or

in the

> example files.
>
> HTH
> Christian
>
>

Actually sounds more like a surface or contour plot. You have x, y,

and

···

z where z=function of (x,y). I thought there was a contour call in
matplotlib. I'll look.

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC 20375
USA
Ph: +202-767-6002
email: pecora@...1125...

-------------------------------------------------------------------------

Using Tomcat but need to do more? Need to support web services,

security?

Get stuff done quickly with pre-integrated technology to make your

job easier

Download IBM WebSphere Application Server v.1.0.1 based on Apache

Geronimo

http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Hanno Klemm
klemm@...948...

I think Louis' idea of using contour plots for your problem is not that bad.
It depends, of course, on the actual meaning of your data ...

Assume you understand German? Have a look here:
http://www.python-forum.de/topic-5294.html

Christian

···

On Friday 13 October 2006 15:19, Hanno Klemm wrote:

Hi Louis,

sorry for being unclear. What I have is a list of data points given in
the format

x y value

so my array looks like

x_1, y_1, v_1
x_2, y_2, v_2,

etc.

Now I want to plot a point at (x_i, y_i) and assign to it a color
according to v_i. The problem is, that the values at x and y are given
and are not calculated.

Christian's suggestion with a scatter plot works fine for me, but if
there are other possibilities I'm always keen to learn something.

Hope this clarifies matters.

Best regards,
Hanno

Louis Pecora <pecora@...1125...> said:
> Christian Meesters wrote:
> > Hi,
> >
> > No stupid question at all! I don't really understand your

question, but it

> > sounds to me like a scatter plot is what you want. In that case,

just have a

> > look at the scatter plot demos on the web page (-> screenshots) or

in the

> > example files.
> >
> > HTH
> > Christian
>
> Actually sounds more like a surface or contour plot. You have x, y,

and

> z where z=function of (x,y). I thought there was a contour call in
> matplotlib. I'll look.
>
> --
> Cheers,
>
> Lou Pecora
>
> Code 6362
> Naval Research Lab
> Washington, DC 20375
> USA
> Ph: +202-767-6002
> email: pecora@...1125...

-------------------------------------------------------------------------

> Using Tomcat but need to do more? Need to support web services,

security?

> Get stuff done quickly with pre-integrated technology to make your

job easier

> Download IBM WebSphere Application Server v.1.0.1 based on Apache

Geronimo

> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hanno Klemm wrote:

Hi Louis,

sorry for being unclear. What I have is a list of data points given in
the format

x y value

so my array looks like

x_1, y_1, v_1
x_2, y_2, v_2,

etc.

Now I want to plot a point at (x_i, y_i) and assign to it a color
according to v_i. The problem is, that the values at x and y are given
and are not calculated.

Christian's suggestion with a scatter plot works fine for me, but if
there are other possibilities I'm always keen to learn something.

Hope this clarifies matters.

Best regards,
Hanno

Got it. Yes, sounds like you want a "3D" scatter plot. v (at some "height) over the surface of x,y points. There is a contour in matplotlib, but I don't think it will do what you want. I will go back and look over matplotlib.

You might want to go to the matplotlib web site and download the examples. There are tons of them. Maybe one is right for you.

···

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC 20375
USA
Ph: +202-767-6002
email: pecora@...1125...

Yes, actually that's even better for what I want. However, after
manipulating the Z values into a 2d array, I can then just as well use
imshow to view their values.

So I'll stick to the scatter plot approach for unevenly spaced data
and to the contour/imshow approach for evenly gridded data.

Thanks again,

Hanno

Christian Meesters <meesters@...624...> said:

I think Louis' idea of using contour plots for your problem is not

that bad.

···

It depends, of course, on the actual meaning of your data ...

Assume you understand German? Have a look here:
http://www.python-forum.de/topic-5294.html

Christian

On Friday 13 October 2006 15:19, Hanno Klemm wrote:
> Hi Louis,
>
> sorry for being unclear. What I have is a list of data points given in
> the format
>
> x y value
>
> so my array looks like
>
> x_1, y_1, v_1
> x_2, y_2, v_2,
>
> etc.
>
> Now I want to plot a point at (x_i, y_i) and assign to it a color
> according to v_i. The problem is, that the values at x and y are given
> and are not calculated.
>
> Christian's suggestion with a scatter plot works fine for me, but if
> there are other possibilities I'm always keen to learn something.
>
> Hope this clarifies matters.
>
> Best regards,
> Hanno
>
> Louis Pecora <pecora@...1125...> said:
> > Christian Meesters wrote:
> > > Hi,
> > >
> > > No stupid question at all! I don't really understand your
>
> question, but it
>
> > > sounds to me like a scatter plot is what you want. In that case,
>
> just have a
>
> > > look at the scatter plot demos on the web page (-> screenshots) or
>
> in the
>
> > > example files.
> > >
> > > HTH
> > > Christian
> >
> > Actually sounds more like a surface or contour plot. You have x, y,
>
> and
>
> > z where z=function of (x,y). I thought there was a contour call in
> > matplotlib. I'll look.
> >
> > --
> > Cheers,
> >
> > Lou Pecora
> >
> > Code 6362
> > Naval Research Lab
> > Washington, DC 20375
> > USA
> > Ph: +202-767-6002
> > email: pecora@...1125...
>
>

-------------------------------------------------------------------------

>
> > Using Tomcat but need to do more? Need to support web services,
>
> security?
>
> > Get stuff done quickly with pre-integrated technology to make your
>
> job easier
>
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>
> Geronimo
>
> >

http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------------------------------------------------------------------

Using Tomcat but need to do more? Need to support web services,

security?

Get stuff done quickly with pre-integrated technology to make your

job easier

Download IBM WebSphere Application Server v.1.0.1 based on Apache

Geronimo

http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Hanno Klemm
klemm@...948...

Hanno,
I wrestled with this one for a while. The attached script is the result
of my effort. The two keys were to define the colormap, and then make
sure that when you call the colormap that the values span the full
range. For example, if you want a data point to be "yellow", and that
color (RGB: 1,1,0) is between 0.75 and 0.85 on your colormap, then give
the point a value of 0.81 (or whatever in the range). Then be sure to
also pass a zero (0.0) and a one (1.0) to the scatter. By spanning the
full scale range you will be sure to fix the color that you want from
the colormap to the data point that you define. It might be a hack, but
it works ok.

Cheers,
Jake

fixed_color_scatter.py (2.85 KB)

fixed_color_scatter.png

···

-----Original Message-----
From: Louis Pecora [mailto:pecora@…1125…]
Sent: Friday, October 13, 2006 7:47 AM
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] plot x y value(x,y)

Hanno Klemm wrote:

Hi Louis,

sorry for being unclear. What I have is a list of data points given in

the format

x y value

so my array looks like

x_1, y_1, v_1
x_2, y_2, v_2,

etc.

Now I want to plot a point at (x_i, y_i) and assign to it a color
according to v_i. The problem is, that the values at x and y are given

and are not calculated.

Christian's suggestion with a scatter plot works fine for me, but if
there are other possibilities I'm always keen to learn something.

Hope this clarifies matters.

Best regards,
Hanno

Got it. Yes, sounds like you want a "3D" scatter plot. v (at some
"height) over the surface of x,y points. There is a contour in
matplotlib, but I don't think it will do what you want. I will go back
and look over matplotlib.

You might want to go to the matplotlib web site and download the
examples. There are tons of them. Maybe one is right for you.

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC 20375
USA
Ph: +202-767-6002
email: pecora@...1125...