Plot points with different colors based on another array

20 visualizaciones (últimos 30 días)
Hello,
I have 3 arrays of the same length X,Y,intensity.
I would like to plot X and Y with 'x' markers, but I also want to change the color of the marker based on the intensity array (0-100).
Is there an easy way to do this in MATLAB?
Many thanks

Respuesta aceptada

Star Strider
Star Strider el 17 de Nov. de 2021
Yes.
x = rand(100,1);
y = rand(100,1);
intensity = randi(99,100,1);
figure
scatter(x, y, 50, intensity, '+')
grid
colormap(turbo)
colorbar
.
  4 comentarios
William McNair
William McNair el 17 de Nov. de 2021
This is extactly what I needed. Thanks again. The matlab comunity is great.
Star Strider
Star Strider el 17 de Nov. de 2021
As always, my pleasure!
Thank you for all of us!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Purple en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by