Hi,

When we apply the plot command to two matrices X and Y of equal size, matlab constructs a plot for every pair of corresponding columns in the two matrices, and assigns colors to the plots according the order specified in the ColorOrder property of the axes. eg:

t = [0:0.01:1]';

rad = [1 2 3 4];

X = cos(2*pi*t)*rad;

Y = sin(2*pi*t)*rad;

plot(X,Y, '*')

If X and Y are vectors instead of matrices, matlab always interprets them as consituting the points of a single plot, no matter whether X and Y are row or column vectors.

Is there any (proper) way to force matlab to interpret X and Y as containing multiple plots with one point each (plotting them according to ColorOrder, which is important to me)?

i.e. if

X = [1 2 3 4]; Y = [6 7 8 9];

then (1,1), (2,2), (3,3) and (4,4) are four "plots" with one point each, and plotted with colors defined by ColorOrder?

Besides a hack consisting of adding a row of zeros to the bottom of X and Y making them into a matrices (then ignoring (0,0) which i know not to be actual data)

I tried

figure; hold on;

X = num2cell(X), Y = num2cell(Y);

plot(X{:}, Y{:}, '*');

which nearly works, but the style property '*' is applied only to the last plot, leaving the first 3 plots nearly invisible.

I realise I could also do it manually by plotting one point at a time and iterating through ColorOrder, but that seems tacky as well.

Any ideas?

You should use SCATTER instead.

--

Steve Lord

XXXX@XXXXX.COM

comp.soft-sys.matlab (CSSM) FAQ: http://www.yqcomputer.com/

1. 3D plots : "points plot" / "nuage de points"

2. How to plot 4 plots in one plot/image/pdf?

3. Re : Showing a single complete plot symbol in a plot legend, e.g. for scatter plots

4. Showing a single complete plot symbol in a plot legend, e.g. for scatter plots

5. Creating a plot with line plot and scatter plot in the same figure

6. plots sent to to a chart tab do not show plot & I loss the plot

7. mixed signal plot and controlling the plot area (size) of each plot?

8. How do you plot multiple plots in an array with no space between plots?

9. Multiple text entries on an XY plot (Vector plot), Possible??

10. plot with vectors plots head on both sides

11. Why is plotting points so much slower than plotting lines in Laview graph controls?

12. Plot points on the same plot inside a loop

13. Plotting 3D points on 2D-contour plots with colors indicating z values

14. Can I plot a single point on a fcontour2d plot?

15. Plotted line to show OVER plotted points

2 post • Page:**1** of **1**