MATLAB: Changing colors in scatter plots

gscatterscatter

Greetings all,
I was trying to somehow change colors of a scatter plot I have of two values.
What I started off with was this:
scatter(ModelFile(:,4), z_i_1_abs)
where the "x" value – ModelFile(:,4) has 1156×1 values, and the same for the "y" value – z_i_1_abs – it also has 1156×1 values. This line plots succesfully, but I want ModelFile(:,4) to be one color and z_i_1_abs to be a separate color. When I plot it now, both are blue.
So I looked at gscatter and the good old plot command, and I tried hold on, but I just keep getting errors.
Any advice?
Thanks!
-J

Best Answer

I'm not sure what you think you want, but perhaps:
dotsize = 10;
n = length(z_i_1_abs);
scatter( 1:n, ModelFile(:,4), dotsize, 'b');
hold on
scatter( 1:n, z_i_1_abs, dotsize, 'r');