필터 지우기
필터 지우기

set color in contour plot with specified colormap

조회 수: 3 (최근 30일)
Yu Li
Yu Li 2018년 10월 4일
댓글: Yu Li 2018년 10월 5일
I have a contour plot with only two value (3 and 5 for example), thus it should appear only two colors.
but I have a colormap with 6 values: cmb=jet(6);
I have plot the contour using command: [xc,yc]=contourf(X,Y,Z);
I want color the contour having value 3 with cmb(3,:), and color the contour having value 5 with cmb(5,:), is it possible to do this?
Thanks!
Yu
  댓글 수: 6
jonas
jonas 2018년 10월 5일
If you use the same limits for the cbar in every plot, then you can make comparisons between graphs using a single cbar.
Yu Li
Yu Li 2018년 10월 5일
I tried to use the same limits for the colorbar, but the problem still exist. I post another topic here:
https://www.mathworks.com/matlabcentral/answers/422448-contourf-plot-different-display-problem
if you are interested could you please take a look?
Thanks!
Yu

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

답변 (1개)

ANKUR KUMAR
ANKUR KUMAR 2018년 10월 5일
clc
clear
contourf(randi(6,5,5))
colormap(jet(5))
colorbar

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by