Delete specific contour line from contour plot
12 次查看(过去 30 天)
显示 更早的评论
I have made a contour plot, due to some reason unknown to me, there is one abnormality in the graph. One contour line is out of order, and I want to delete it. Kindly if someone can help or guide me to get rid of the contour line with ‘0’ markings. I am using the following code:
contour(X,Y,M,'ShowText','on');
here M is a matrix of size and X & Y are also matrices of same size and obtained as
[X,Y]=meshgrid(x,y);
Following is the output
I am not an expert in MATLAB, maybe that's the reason I am unable to figure out the cause for the occurrence of this contour line. I’ve also attached the data matrix for this code.
Thanks a lot for your help.
0 个评论
采纳的回答
Bjorn Gustavsson
2019-4-5
It is not obvious to me which contour you want to remove, but if you don't want, for example the 0-level contour you do:
contour(X,Y,M,[0.1:0.1:1])
If it is some other contour you need to purge you might have to be a bit more hands-on:
[Qc,Hc] = contour(peaks(123));
Hcc = get(Hc,'children'); % Handles to the contour segments at least in my matlab-version
delete(Hcc(4)) % If the fourth contour-segment is the offending one...
HTH
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!