How to label the levels of a fcontour plot?
14 次查看(过去 30 天)
显示 更早的评论
0 个评论
采纳的回答
Star Strider
2017-4-14
You must use the contour function to get the contour labels.
Combining fcontour and contour to get the result you want (in figure(2) here) is not difficult. You first need to get the data fcontour creates. You can do that by returning the handle to it, and then accessing its properties.
Using an example from the documentation for fcontour and adapting it to use contour:
syms f(x,y)
f(x,y) = sin(x) + cos(y);
figure(1)
hfc = fcontour(f);
figure(2)
contour(hfc.XData, hfc.YData, hfc.ZData, 'ShowText','on')
Although this takes one more line of code, it will give you the result you want.
2 个评论
Star Strider
2017-4-15
My pleasure.
The two functions have some significant differences. The outputs from fcontour are matrices, while the outputs from contour are the the vectors of (x,y) coordinates for each contour.
更多回答(0 个)
另请参阅
类别
在 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!