2D colored plot

6 visualizaciones (últimos 30 días)
Sander Ustrup
Sander Ustrup el 20 de Abr. de 2020
Comentada: Sander Ustrup el 20 de Abr. de 2020
Hello everyone,
I'm looking to make a 2D plot, with coordinates (x,y), with colored dots according to a magnitude/strength z
I'm trying to recreate this following plot from the program homer energy Pro
So i'm thinking of the following,
z = randi(10,1,8760);
for x=1:7
for y=1:24
scatter3(x,y,z(x*y),'filled')
hold on
end
end
colorbar
From this i get:
So the problems im facing right now:
  • I want to make more of a line plot, so the whole plot is covered. Of course it will help when the x-axis becomes 365 wide,
  • How do i make the colorbar match the z-value?
  • Is scatterplot the best way to do what im trying to do? I've researched the documentation of plot3 and surf commands, but those require a function from what I've read.
Thank you in advance, any suggestions are welcome
Best regards,

Respuesta aceptada

KSSV
KSSV el 20 de Abr. de 2020
z = randi(10,1,8760);
x=1:7
y=1:24
[X,Y] = meshgrid(x,y) ;
Z = z(X.*Y) ;
pcolor(X,Y,Z)
shading interp
colorbar
  1 comentario
Sander Ustrup
Sander Ustrup el 20 de Abr. de 2020
Exactly what i was looking for, thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by