# adding contour lines to pcolor plot

조회 수: 41 (최근 30일)
Giulia 2023년 3월 21일
댓글: Mathieu NOE 2023년 3월 27일
Hi everyone,
I'm trying to add contour lines at 13 degrees to my pcolor plot, but I get the following error:
Error using contour
Input arguments must be numeric or objects which can be converted to double.
Here's my code:
t1 = datetime(2021, 5, 1)
t2 = datetime(2021, 9, 30)
dateVector = t1:t2
combinedaverages = [dailyaverages; dailyaverages06; dailyaverages07; dailyaverages08; dailyaverages09];
figure
pcolor(dateVector, depth, combinedaverages')
set(gca, 'YDir','reverse')
ylim([0 70])
colorbar
hold on
contour(dateVector,depth,combinedaverages',[13 13],'k');
Variables in the code are:
combine averages: 153x33 double
depth: 33x1 single
dateVector: 1x153 datetime
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
편집: Adam Danz 2023년 3월 22일
The data are the variables you mentioned in your question. If you save them to a mat file and attach them we can run the code in your question.
Giulia 2023년 3월 23일
Here are my mat files:

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

### 채택된 답변

Mathieu NOE 2023년 3월 24일
hello again
maybe this ?
figure
pcolor(dateVector, depth, combinedaverages')
set(gca, 'YDir','reverse')
ylim([0 70])
colorbar
hold on
contour(1:numel(dateVector),depth,combinedaverages','k');
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
Giulia 2023년 3월 27일
Great! Thank you so much again for your help!
All the best
Mathieu NOE 2023년 3월 27일
My pleasure !

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

### 카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by