2D scatter plot with Z-value in color

Hi all,
It’s a basic question but I struggle to find the answer on the Internet...
I have a matrix with x,y and z colum, representing the c-coordinate, the y-coordinate and depth (z).
I’d like to plot (x,y) but that those points show a colorscale depending on the depth value (just the point colors I don’t want an interpolation).
Can somebody help me please?

1 Comment

Would anyone be able to tell me how to do this but then interpolate the colours?

Sign in to comment.

 Accepted Answer

pointsize = 10;
scatter(x, y, pointsize, z);

10 Comments

Great thanks! Do you know how I can set full points and not just the border?
OOuupsss got it.
Thanks again!
Carlos Noton's response:
Thank you!
Thank you.
I managed to color the points (with the default color scheme) according to a third variable. However, how can I change the colour scheme? And ho can I get a legend with a color bar?
Cheers
Is there a possibilty of getting this visualization with a color bar?
Yeah, that is basically my same question!
Hi. Could you tell me how you did color gradient with z value?
Not sure if you still need the color bar:
cb = colorbar();

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!