Scatter not working in 2018

7 views (last 30 days)
Jennifer MacKinnon
Jennifer MacKinnon on 18 Jul 2018
Edited: dpb on 2 Jan 2020
Hi, I can't get the "scatter" function to work using the option to input a vector to set the marker colors.
Here's the example in the 'help' text:
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
c = linspace(1,10,length(x));
scatter(x,y,[],c)
When I run this I get the following error: "Warning: Error updating Scatter. Not enough input arguments."
I have just upgraded to the 2018 release and use this function frequently. It works if you set the color in other ways (e.g. as a constant, or bunch of rgb triplets), but I'd specifically like to use a vector to color my markers.
Any help appreciated!
  10 Comments
Cameron McNaughton
Cameron McNaughton on 2 Jan 2020
"c" is a 1 x 33 vector of numeric values. Same size as x and y, also numeric vectors.
I belive MATLAB should automatically create a colour scale from the vector "c".
dpb
dpb on 2 Jan 2020
Edited: dpb on 2 Jan 2020
I've at least temporarily lost access so can't test...try reversing the order of the marker argument 's' and the color vector. The sequence in the doc makes me wonder...and I don't recall sufficiently any peculiarities have run into before regarding parsing the inputs.
Seems like I do remember it being picky about column/row vectors matching...why did you transpose c but not x,y? I'd make them all consistent on input even though the indications are it did apparently read those ok as noted I've vague recollections of issues on that score in the past.

Sign in to comment.

Answers (0)

Tags

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!