필터 지우기
필터 지우기

How to plot a contourf ?

조회 수: 1 (최근 30일)
Inês Mendes
Inês Mendes 2015년 7월 9일
댓글: Inês Mendes 2015년 7월 9일
Hi guys,
Do any of you know if it is possible to plot a contourf in which my y axis corresponds to a string array, my x axis to a time array, and my Z to a numeric array?
Thanks in advance!
Inês

채택된 답변

Mike Garrity
Mike Garrity 2015년 7월 9일
편집: Mike Garrity 2015년 7월 9일
The easiest way to deal with non-numeric data is to give contour numeric indices into the data and use the data as your TickLabels:
xoptions = {'left','center','right'};
yoptions = {'bottom','middle','top'};
nx = length(xoptions);
ny = length(yoptions);
contourf(1:nx,1:ny,randn(ny,nx))
set(gca,'XTick',1:nx,'XTickLabels',xoptions)
set(gca,'YTick',1:ny,'YTickLabels',yoptions)
Datetimes are similar, but you need to turn them into strings before using them as tick labels:
yoptions = datetime(2015,1:3,1);
ny = length(yoptions);
set(gca,'YTick',1:ny,'YTickLabels',datestr(yoptions))
  댓글 수: 1
Inês Mendes
Inês Mendes 2015년 7월 9일
Thank you :)

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

추가 답변 (0개)

카테고리

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