2D color plot with 3 vectors
Show older comments
I have three vectors: x, y and z. Each (x(i), y(i)) coordinate corresponds to one z(i). I want to plot a 2D plot with x, y as axes and z denotes the colors. What should I do? Thanks a lot.
Accepted Answer
More Answers (3)
Richard
on 28 Mar 2012
1 vote
you could use pcolor(x,y,z). If you need further instruction let me know.
2 Comments
Zhiting
on 28 Mar 2012
Walter Roberson
on 28 Mar 2012
image() would be better than pcolor().
pcolor() and image() would assume that you have a full matrix of data, but the user only has vectors -- scattered points.
Thomas
on 28 Mar 2012
Just adding if you need a 3d graph:
dotsize=25
scatter3(x(:), y(:), z(:), dotsize, z(:), 'filled')
SSth
on 26 Oct 2017
0 votes
How can I change color pattern.
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!