Scatter not working in 2018

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 comentarios

dpb
dpb el 18 de Jul. de 2018
Looks like they broke it...bug report time.
Just to be sure, what does
which -all scatter
return to ensure something isn't aliasing the correct routine.
Albert Fan
Albert Fan el 18 de Jul. de 2018
I've tried myself and running into no errors using R2018a, can you provide more context of your problem, maybe you have some other variables floating around that makes this error?
dpb
dpb el 18 de Jul. de 2018
Just saw something I missed...the error says
: "Warning: Error updating Scatter. Not enough input arguments."
"Scatter" is capitalized...is that a klew?; the ML routine is all lowercase.
Walter Roberson
Walter Roberson el 18 de Jul. de 2018
However, scatter objects are matlab.graphics.chart.primitive.Scatter class, and perhaps the error message is coming from that class.
dbstop if caught error
might help track the problem down.
Cameron McNaughton
Cameron McNaughton el 27 de Dic. de 2019
Having this exact same error in 2019b. Cannot run my script, or the MATLAB examples. Have used this function multiple times before installing 2019b.
works fine if just:
scatter(x,y,25); or
scatter(x,y,25,'s','filled')
but as soon as you add:
scatter(x,y,25,c)
"Warning: Error updating Scatter. Not enough input arguments."
Were you able to solve this problem?
Walter Roberson
Walter Roberson el 27 de Dic. de 2019
What is your c? Class and size?
Cameron McNaughton
Cameron McNaughton el 2 de En. de 2020
S = scatter(x, y,36, c', 's', 'filled')
***
Warning: Error updating Scatter.
Not enough input arguments.
***
S =
Scatter with properties:
Marker: 'square'
MarkerEdgeColor: 'none'
MarkerFaceColor: 'flat'
SizeData: 36
LineWidth: 0.5
XData: [1×33 double]
YData: [1×33 double]
ZData: [1×0 double]
CData: [1×33 double]
***
Only fails if CData passed to the function and seems to fail inside the try/catch starting at line 122 in scatter.m. Really baffled by this.
Walter Roberson
Walter Roberson el 2 de En. de 2020
What is your c? Class and size?
Cameron McNaughton
Cameron McNaughton el 2 de En. de 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 el 2 de En. de 2020
Editada: dpb el 2 de En. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Versión

R2018a

Etiquetas

Preguntada:

el 18 de Jul. de 2018

Editada:

dpb
el 2 de En. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by