Add markers to a contour plot

조회 수: 132 (최근 30일)
Ahmad Zueter
Ahmad Zueter 2020년 12월 29일
댓글: Ameer Hamza 2020년 12월 29일
Hi,
Is there anyway to add markers to a contour plot? with a recent Matlab edition (i.e, 2017 and after)? My contour command looks something like that:
[x,y]=meshgrid(1:10,2:100):
% z is a matrix already predefined on the x and y levels
[c,h]=contour(x,y,z,levels)
When I add 'Marker' to the contour command specifications, I get the following error: unrecognized property Marker for class contour
Best,

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 12월 29일
It is not possible with single call of contour(). You need to hold the axes and then make a seperate call to plot() or scatter(). For example
Z = peaks(100);
x = [20 50 40 90];
y = [45 23 10 78];
contour(Z)
hold on
plot(x, y, '+', 'LineWidth', 2, 'MarkerSize', 10)
  댓글 수: 8
Ahmad Zueter
Ahmad Zueter 2020년 12월 29일
This is Great! Thank you a lot!
Ameer Hamza
Ameer Hamza 2020년 12월 29일
I am glad to be of help!!!

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

추가 답변 (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