2D plot with 3rd variable
Mostrar comentarios más antiguos
hey, i have many lines in X and Y axes, need to color each line according to a variable Z, how to do that ?
x
y
already plotted all the lines needed but need to add the color for each line according to the value of Z. for example if Z= 0 the line will take a color and if it;s 0.8 it takes another color( i mean how to add a colorbar for this )
thanks
4 comentarios
John Doe
el 12 de Jul. de 2019
Can you show an example plot?
If you want to do a scatter plot this is easy:
scatter(x,y,100,z)
Where 100 just refers to the size of the point.
Michel tawil
el 12 de Jul. de 2019
John Doe
el 12 de Jul. de 2019
You can modify the following code for your purposes.
where n will = the size of averageV
y(1:241,1) = 1:241
n = size(y, 1);
colors = hsv(n);
h = line([0 10], [y(1:241,1) y(1:241,1)])
set(h, {'color'}, num2cell(colors, 2));
Michel tawil
el 13 de Jul. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!