How To Put String Labels on Contours for Contour Plots in MATLAB

╄→尐↘猪︶ㄣ 提交于 2019-11-30 20:57:31

In this case, hcl is actually an array which stores handles to every contour label on your plot. When you set properties using the array (as in your code),

set(hcl, 'name', 'value')

You will set the property of every label to the same value.

You can change the properties of individual labels by iterating over the array. For example, this is how you would add a percentage sign:

for i = 1:length(hcl)
    oldLabelText = get(hcl(i), 'String');
    percentage = str2double(oldLabelText)*100;
    newLabelText = [num2str(percentage) ' %'];
    set(hcl(i), 'String', newLabelText);
end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!