Plot Single Point on 3D Graph (Error: Not enough input arguments)

165 visualizzazioni (ultimi 30 giorni)
Hello, I have a 3D graph already plotted. I am just trying to plot a point among the data I already have plotted. I keep getting error: Not enough input arguments.
I have tried this two ways:
1)
hold on
plot3(388.06, 153.35, 163.66,'+','k','MarkerSize',10);
2)
hold on
X = 388.06;
Y = 153.35;
Z = 163.66;
plot3(X,Y,Z,'+','k','MarkerSize',10);
Let me know if you know my error. Thanks!

Risposta accettata

Walter Roberson
Walter Roberson il 22 Dic 2020
In context, '+' and 'k' are both examples of "linespec" . You can have at most one linespec for every group of points.
The easiest approach would be
plot3(X, Y, Z, '+k', 'MarkerSize', 10);
but you could also use
plot3(X, Y, Z, '+', 'Color', 'k', 'MarkerSize', 10);
Note that when you use name/value pairs, that all of them must come at the end of the call, and that they apply to all of the data triples, not just to the "nearest" data triple. So for example,
plot3(X, Y, Z, '+', X1, Y1, Z1, 'Color', 'k', 'MarkerSize', 10);
would apply the linespace '+' to X, Y, Z, and would apply the Color and MarkerSize to X, Y, Z as well, but X1, Y1, Z1 would use the default marker (because no linespec giving the marker and no 'Marker' name/value pair) but would use the Color and MarkerSize because those apply to all data.

Più risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by