color vector in plot
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Is it possible to write
plot(x,y,color)
where x, y and color are all arrays of the same length. color is an array to set a color for all points drawn by x and y arrays, i.e. coordinate (x(i), y(i)) has a color: color(i). It's easy to write in the component form in a for loop, but I'd like to write in the vector form.
0 Commenti
Risposta accettata
KSSV
il 19 Dic 2018
Read about scatter . Also check the below option:
x = 0:.05:2*pi;
y = sin(x);
z = zeros(size(x));
col = x; % This is the color, vary with x in this case.
surface([x;x],[y;y],[z;z],[col;col],...
'facecol','no',...
'edgecol','interp',...
'linew',2);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Scatter Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!