From: Aram on
Good morning. Suppose I have a table of data with multiple columns. The first column has X values, and the second (say) has Y values to be plotted against X. The remaining columns have other data associated with X, but I'm not going to plot those.

Now suppose I want to plot X against Y, but I want the markers to vary in shape, color, or some other visible characteristic depending on the values of data in columns that I am not plotting. Now granted, I could write a series of loops to parse the data array into smaller arrays, and plot each. But that's a lot of work, and it would be more compact and readable if I could use the other data columns parametrically to set marker characteristics.

I'm still fairly new to Matlab, but as a long-time Mathematica user, this is a fairly common thing to do. Is it straightforward in Matlab? Thanks, my searches have come up short.

Oh yeah. Ideally, I could create a legend containing each symbol type, even though only only y-series is being plotted.

Appreciate any help I can get...

Aram : )
From: us on
"Aram " <tkdawacs_removeme_(a)yahoo.com> wrote in message <hqn8us$5hf$1(a)fred.mathworks.com>...
> Good morning. Suppose I have a table of data with multiple columns. The first column has X values, and the second (say) has Y values to be plotted against X. The remaining columns have other data associated with X, but I'm not going to plot those.
>
> Now suppose I want to plot X against Y, but I want the markers to vary in shape, color, or some other visible characteristic depending on the values of data in columns that I am not plotting. Now granted, I could write a series of loops to parse the data array into smaller arrays, and plot each. But that's a lot of work, and it would be more compact and readable if I could use the other data columns parametrically to set marker characteristics.
>
> I'm still fairly new to Matlab, but as a long-time Mathematica user, this is a fairly common thing to do. Is it straightforward in Matlab? Thanks, my searches have come up short.
>
> Oh yeah. Ideally, I could create a legend containing each symbol type, even though only only y-series is being plotted.
>
> Appreciate any help I can get...
>
> Aram : )

well... there's not a ML stock function, which does what you want, and, as you said, you'd have to write a loop...
however, the code for such a loop is very simple to write in ML, especially if you use one of the columns as a grouping index...

us
From: Steven Lord on

"Aram " <tkdawacs_removeme_(a)yahoo.com> wrote in message
news:hqn8us$5hf$1(a)fred.mathworks.com...
> Good morning. Suppose I have a table of data with multiple columns. The
> first column has X values, and the second (say) has Y values to be plotted
> against X. The remaining columns have other data associated with X, but
> I'm not going to plot those.
>
> Now suppose I want to plot X against Y, but I want the markers to vary in
> shape, color, or some other visible characteristic depending on the values
> of data in columns that I am not plotting. Now granted, I could write a
> series of loops to parse the data array into smaller arrays, and plot
> each. But that's a lot of work, and it would be more compact and readable
> if I could use the other data columns parametrically to set marker
> characteristics.
>
> I'm still fairly new to Matlab, but as a long-time Mathematica user, this
> is a fairly common thing to do. Is it straightforward in Matlab? Thanks,
> my searches have come up short.
>
> Oh yeah. Ideally, I could create a legend containing each symbol type,
> even though only only y-series is being plotted.

Varying in color is easy -- SCATTER. Varying in marker shape is a little
trickier, though I believe you can still do it using SCATTER and modifying a
property of the object whose handle is returned.

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


From: Bjorn Gustavsson on
"us " <us(a)neurol.unizh.ch> wrote in message <hqne04$gbk$1(a)fred.mathworks.com>...
>
[major snip]
>
> yes, SCATTER...
> if(f) the OP does not want to connect the data by lines with different attributes as well...
>
> us
>
For plotting a curve that varies in colour there is 2-3 functions on the file exchange that gets the work done. Two are called cline (or if it was cplot, one of them I've used with sattisfactory results).

HTH,
Bjoern