필터 지우기
필터 지우기

2D color plot with 3 vectors

조회 수: 33 (최근 30일)
Zhiting
Zhiting 2012년 3월 28일
댓글: Riley Weatherholt 2021년 2월 23일
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.

채택된 답변

Walter Roberson
Walter Roberson 2012년 3월 28일
pointsize = 10;
scatter(x, y, pointsize, z)
  댓글 수: 2
Zhiting
Zhiting 2012년 3월 28일
Thanks a lot, Walter. This is what I want!
Riley Weatherholt
Riley Weatherholt 2021년 2월 23일
Thank you!! You just saved me a bunch of time.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Richard
Richard 2012년 3월 28일
you could use pcolor(x,y,z). If you need further instruction let me know.
  댓글 수: 2
Zhiting
Zhiting 2012년 3월 28일
I have checked that before. z must be matrix in order to use pcolor. But I have three vectors. It doesn't work.
Walter Roberson
Walter Roberson 2012년 3월 28일
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
Thomas 2012년 3월 28일
Just adding if you need a 3d graph:
dotsize=25
scatter3(x(:), y(:), z(:), dotsize, z(:), 'filled')
  댓글 수: 1
Zhiting
Zhiting 2012년 3월 28일
Thanks, Thomas~

댓글을 달려면 로그인하십시오.


SSth
SSth 2017년 10월 26일
How can I change color pattern.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by