Add markers to a contour plot

287 views (last 30 days)
Ahmad Zueter
Ahmad Zueter on 29 Dec 2020
Commented: Ameer Hamza on 29 Dec 2020
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:
% z is a matrix already predefined on the x and y levels
When I add 'Marker' to the contour command specifications, I get the following error: unrecognized property Marker for class contour

Accepted Answer

Ameer Hamza
Ameer Hamza on 29 Dec 2020
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];
hold on
plot(x, y, '+', 'LineWidth', 2, 'MarkerSize', 10)
Ameer Hamza
Ameer Hamza on 29 Dec 2020
I am glad to be of help!!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by