adding contour lines to pcolor plot
30 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Giulia
am 21 Mär. 2023
Kommentiert: Mathieu NOE
am 27 Mär. 2023
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')
shading flat
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1332160/image.png)
4 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 24 Mär. 2023
hello again
maybe this ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1335019/image.png)
figure
pcolor(dateVector, depth, combinedaverages')
set(gca, 'YDir','reverse')
shading flat
ylim([0 70])
colorbar
hold on
contour(1:numel(dateVector),depth,combinedaverages','k');
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Contour Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!