필터 지우기
필터 지우기

Plotting values with colormap of xy-plane?

조회 수: 18 (최근 30일)
Sharif Khalil
Sharif Khalil 2018년 7월 23일
댓글: Sharif Khalil 2018년 7월 24일
I have used countourf(X,Y,Z); I have X, Y, Z are (11X300) matrix; I need to plot values of Z with different colors on a x-y plane. note that X is originally a vector(1X300) and Y is (1X11), by meshgrid it was turned into the same size of Z. I do not know how to plot Z values on the x-y plane with different colors.
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 7월 24일
contourf() uses different colors for different z values by default.
Sharif Khalil
Sharif Khalil 2018년 7월 24일
Yes, I needed another way for plotting, since I didn't like the result, I found surf() with view(90) gives a better looking plot, thanks.

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 7월 24일
pcolor(X, Y, Z) is the same as surf(X, Y, Z, 'edgecolor', 'none') followed by view(90)
If your X and Y are consecutive integers starting from 1, then you could just
pcolor(Z)
Note that when you pcolor or surf, that the number of output "pixels" is one fewer in each direction than the number of rows or columns. surf determines the color of each pixel by interpolation from the four corner vertices.
If your X and Y are linear and equidistant, you could consider using
imagesc(X, Y, Z)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by