Control and use greek letter of the contour diagrams
1 次查看(过去 30 天)
显示 更早的评论
Hi,
Do you know how I can control the labels better of this contour diagram. So it is only placed in the middle and not near the end.
And do you know how I can incrporate a greek letter in the labels of the contour diagram. Forexample \epsilon = 7 %.
figure; hold on ; box on
[CC,hh] = contour(x,y,z'*100,[1 3 8 11 15],'LineWidth',1.5,'edgeColor','#191970',"LabelFormat",@myfun);
[C,h] = contour(x,y,z'*100,[0.1 0.3 0.5 1.5 2 4 5 6 7 9 10 12 13 14],'LineWidth',1.5,'edgeColor','#7FFFD4',"LabelFormat",@myfun);
set(gca, 'XScale', 'log')
clabel(C,h,'labelspacing',500,'Interpreter','latex','fontsize',12)
clabel(CC,hh,'labelspacing',500,'Interpreter','latex','fontsize',12)
ylabel('Deviatoriq ampltiude, $q^{ampl} \ (\%)$','FontSize',17); xlabel('Number of cycles, $N$ (-)','FontSize',17,'FontName','times')
colororder(newcolors)
text(1E5,180,{' $p^{av} = 200 \ \mathrm{kPa}$',' $I_{d0} = 20 \ \%$'},'Interpreter','latex','fontsize',14)
text(2E3,180,{' $ = \varepsilon^{acc} \ $'},'Interpreter','latex','fontsize',16)
function labels = myfun(vals)
labels = vals + " \% ";
end
0 个评论
回答(1 个)
Voss
2024-3-25
Here's how you can incorporate a Greek letter into the contour labels:
x = 10.^(0:6);
y = 0:10:200;
z = (1+y).*log10(x.')/4000;
figure; hold on ; box on
[CC,hh] = contour(x,y,z'*100,[1 3 8 11 15],'LineWidth',1.5,'edgeColor','#191970',"LabelFormat",@myfun);
[C,h] = contour(x,y,z'*100,[0.1 0.3 0.5 1.5 2 4 5 6 7 9 10 12 13 14],'LineWidth',1.5,'edgeColor','#7FFFD4',"LabelFormat",@myfun);
set(gca, 'XScale', 'log')
clabel(C,h,'labelspacing',500,'Interpreter','latex','fontsize',12)
clabel(CC,hh,'labelspacing',500,'Interpreter','latex','fontsize',12)
function labels = myfun(vals)
labels = "$\epsilon = " + vals + "\%$";
end
I don't know of a reliable way to control the placement of the labels, other than by playing with the labelspacing.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Labels and Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!