Thread Subject: noob: 3D plot with colour as 4th dimension?

Subject: noob: 3D plot with colour as 4th dimension?

From: noemailplease

Date: 11 Mar, 2010 11:44:13

Message: 1 of 6

I have recently stated using MatLab and have come across a problem with
plotting:

I have data [x,y,z,gain] and would like to represent this on a plot of
some sort. What I am thinking is a 3D plot of (x,y,z) where the colour
of that point is defined using a colormap (hot) for the value at that point.

Is this possible? If so, how? An example would be appreciated. Or is
there another way?



Thanks in advance.

Subject: 3D plot with colour as 4th dimension?

From: Steven Lord

Date: 11 Mar, 2010 14:12:24

Message: 2 of 6


"noemailplease" <noemailplease@nno.email.please> wrote in message
news:5-udnWFvuIsGSgXWnZ2dnUVZ_s-dnZ2d@westnet.com.au...
>I have recently stated using MatLab and have come across a problem with
>plotting:
>
> I have data [x,y,z,gain] and would like to represent this on a plot of
> some sort. What I am thinking is a 3D plot of (x,y,z) where the colour of
> that point is defined using a colormap (hot) for the value at that point.
>
> Is this possible? If so, how? An example would be appreciated. Or is
> there another way?

Take a look at the SURF or SCATTER3 functions.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: 3D plot with colour as 4th dimension?

From: TideMan

Date: 11 Mar, 2010 19:09:43

Message: 3 of 6

On Mar 12, 3:12 am, "Steven Lord" <sl...@mathworks.com> wrote:
> "noemailplease" <noemailple...@nno.email.please> wrote in message
>
> news:5-udnWFvuIsGSgXWnZ2dnUVZ_s-dnZ2d@westnet.com.au...
>
> >I have recently stated using MatLab and have come across a problem with
> >plotting:
>
> > I have data [x,y,z,gain] and would like to represent this on a plot of
> > some sort.  What I am thinking is a 3D plot of (x,y,z) where the colour of
> > that point is defined using a colormap (hot) for the value at that point.
>
> > Is this possible?  If so, how?  An example would be appreciated.  Or is
> > there another way?
>
> Take a look at the SURF or SCATTER3 functions.
>
> --
> Steve Lord
> sl...@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ:http://matlabwiki.mathworks.com/MATLAB_FAQ

Also contourf

Subject: 3D plot with colour as 4th dimension?

From: noemailplease

Date: 12 Mar, 2010 05:22:06

Message: 4 of 6

TideMan wrote:
> On Mar 12, 3:12 am, "Steven Lord" <sl...@mathworks.com> wrote:
>> "noemailplease" <noemailple...@nno.email.please> wrote in message
>>
>> news:5-udnWFvuIsGSgXWnZ2dnUVZ_s-dnZ2d@westnet.com.au...
>>
>>> I have recently stated using MatLab and have come across a problem with
>>> plotting:
>>> I have data [x,y,z,gain] and would like to represent this on a plot of
>>> some sort. What I am thinking is a 3D plot of (x,y,z) where the colour of
>>> that point is defined using a colormap (hot) for the value at that point.
>>> Is this possible? If so, how? An example would be appreciated. Or is
>>> there another way?
>> Take a look at the SURF or SCATTER3 functions.
>>
>> --
>> Steve Lord
>> sl...@mathworks.com
>> comp.soft-sys.matlab (CSSM) FAQ:http://matlabwiki.mathworks.com/MATLAB_FAQ
>
> Also contourf


Thanks for the feedback so far, but this hasn't helped me.

I think the first part of the problem (other that I am new to this!) is
the data is not in the right "format" for the plotting functions.

I have a list of values collected through experimentation:
input1, input2, input3, gain
1 1 1 -1.0342
1 1 2 -1.0311
1 1 3 -1.3286
...
...
256 256 256 10.8734

I guess I must first do something to this data to get it "ready" for
plotting? If so, what?

Then, how do I get MatLab to colour the point at (x,y,z) in accordance
with the value of the gain for that point? (I am also guessing the gain
value might have to be normalized [0,1] to be best interpreted by the
colormap??)


Any more help is appreciated.

Subject: 3D plot with colour as 4th dimension?

From: Ken Garrard

Date: 12 Mar, 2010 15:20:21

Message: 5 of 6

noemailplease <noemailplease@nno.email.please> wrote in message <TP-dnUrMr8kTUgTWnZ2dnUVZ_qWdnZ2d@westnet.com.au>...
> TideMan wrote:
> > On Mar 12, 3:12 am, "Steven Lord" <sl...@mathworks.com> wrote:
> >> "noemailplease" <noemailple...@nno.email.please> wrote in message
> >>
> >> news:5-udnWFvuIsGSgXWnZ2dnUVZ_s-dnZ2d@westnet.com.au...
> >>
> >>> I have recently stated using MatLab and have come across a problem with
> >>> plotting:
> >>> I have data [x,y,z,gain] and would like to represent this on a plot of
> >>> some sort. What I am thinking is a 3D plot of (x,y,z) where the colour of
> >>> that point is defined using a colormap (hot) for the value at that point.
> >>> Is this possible? If so, how? An example would be appreciated. Or is
> >>> there another way?
> >> Take a look at the SURF or SCATTER3 functions.
> >>
> >> --
> >> Steve Lord
> >> sl...@mathworks.com
> >> comp.soft-sys.matlab (CSSM) FAQ:http://matlabwiki.mathworks.com/MATLAB_FAQ
> >
> > Also contourf
>
>
> Thanks for the feedback so far, but this hasn't helped me.
>
> I think the first part of the problem (other that I am new to this!) is
> the data is not in the right "format" for the plotting functions.
>
> I have a list of values collected through experimentation:
> input1, input2, input3, gain
> 1 1 1 -1.0342
> 1 1 2 -1.0311
> 1 1 3 -1.3286
> ...
> ...
> 256 256 256 10.8734
>
> I guess I must first do something to this data to get it "ready" for
> plotting? If so, what?
>
> Then, how do I get MatLab to colour the point at (x,y,z) in accordance
> with the value of the gain for that point? (I am also guessing the gain
> value might have to be normalized [0,1] to be best interpreted by the
> colormap??)
>
>
> Any more help is appreciated.

Try the FEX function plot3k. Id# is 9519.

Subject: 3D plot with colour as 4th dimension?

From: noemailplease

Date: 13 Mar, 2010 12:20:47

Message: 6 of 6

Ken Garrard wrote:
> noemailplease <noemailplease@nno.email.please> wrote in message
> <TP-dnUrMr8kTUgTWnZ2dnUVZ_qWdnZ2d@westnet.com.au>...
>> TideMan wrote:
>> > On Mar 12, 3:12 am, "Steven Lord" <sl...@mathworks.com> wrote:
>> >> "noemailplease" <noemailple...@nno.email.please> wrote in message
>> >>
>> >> news:5-udnWFvuIsGSgXWnZ2dnUVZ_s-dnZ2d@westnet.com.au...
>> >>
>> >>> I have recently stated using MatLab and have come across a problem
>> with
>> >>> plotting:
>> >>> I have data [x,y,z,gain] and would like to represent this on a
>> plot of
>> >>> some sort. What I am thinking is a 3D plot of (x,y,z) where the
>> colour of
>> >>> that point is defined using a colormap (hot) for the value at that
>> point.
>> >>> Is this possible? If so, how? An example would be appreciated.
>> Or is
>> >>> there another way?
>> >> Take a look at the SURF or SCATTER3 functions.
>> >>
>> >> --
>> >> Steve Lord
>> >> sl...@mathworks.com
>> >> comp.soft-sys.matlab (CSSM)
>> FAQ:http://matlabwiki.mathworks.com/MATLAB_FAQ
>> > > Also contourf
>>
>>
>> Thanks for the feedback so far, but this hasn't helped me.
>>
>> I think the first part of the problem (other that I am new to this!)
>> is the data is not in the right "format" for the plotting functions.
>>
>> I have a list of values collected through experimentation:
>> input1, input2, input3, gain
>> 1 1 1 -1.0342
>> 1 1 2 -1.0311
>> 1 1 3 -1.3286
>> ...
>> ...
>> 256 256 256 10.8734
>>
>> I guess I must first do something to this data to get it "ready" for
>> plotting? If so, what?
>>
>> Then, how do I get MatLab to colour the point at (x,y,z) in accordance
>> with the value of the gain for that point? (I am also guessing the
>> gain value might have to be normalized [0,1] to be best interpreted by
>> the colormap??)
>>
>>
>> Any more help is appreciated.
>
> Try the FEX function plot3k. Id# is 9519.

Thanks Ken, that is the exact function I need. Great work too!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com