stem3 color variation / alternatives ?

2 visualizaciones (últimos 30 días)
analogy
analogy el 28 de Nov. de 2014
Respondida: Star Strider el 28 de Nov. de 2014
[X,Y]=meshgrid(1:1:1000,1:100);
Z = noise; %Noise is a 100x1000 matrix%
stem3(X,Y,Z);
My question is : how to vary color of Z ? I mean, I want to vary color (important - randomly ), as without color variation, there is no way to look at floor of this data. Attached is the stem3 plot with single color.How do I vary color of data for every different value of Y ? Thanks.
  1 comentario
Thorsten
Thorsten el 28 de Nov. de 2014
You forgot to attach the stem3 plot.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 28 de Nov. de 2014
You can change the stem colour by specifying 'Color' and the marker face colour with 'MarkerFaceColor'. To change them to each have different colours, you have to plot them individually in a loop, changing the colour with each iteration for each data point.
This works with R2014b and earlier, but it is relatively easy to change it to use R2014b handle syntax:
s = [1.35846579 -0.010903161 -1.35846579 -2.466e-05
2.71686196 -0.033203464 -2.71686196 -4.506e-05
4.07514048 -0.066900126 -4.07514048 -6.485e-05
5.43325424 -0.111991957 -5.43325424 -8.391e-05
6.79115438 -0.168477371 -6.79115438 -0.000102];
cr = colormap(jet);
figure(1)
hold on
for k1 = 1:size(s,1)
randcol = randi(size(cr,1));
stem3(s(k1,1), s(k1,2), s(k1,3), 'fill', 'MarkerFaceColor', cr(randcol,:))
end
hold off
grid on
view(-30, 30)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by