Bold symbol in Matlab legend -
i have plot in matlab following legend:
h = legend('reference','$\hat{\theta}_2 = 5\theta_2$','$\hat{\theta}_2 = 10\theta_2$'); set(h,'interpreter','latex')
now want make variables \theta
bold faced use in latex report.
i tried:
h = legend('reference','$\hat{\mathbf{\theta}}_2 = 5\mathbf{\theta}_2$','$\hat{\mathbf{\theta}}_2 = 10\mathbf{\theta}_2$'); set(h,'interpreter','latex')
unfortunately not working.
for reason bold symbols possible tex interpreter, way can't use \hat{...}
. need decide, if either want use bold symbols or hat , other latex-only stuff:
x = 1:100; y1 = sin(x/2).^2; y2 = -sin(x/2).^2; f = figure(1); p(1) = plot(x,zeros(numel(x),1)); hold on p(2) = plot(x,y1); hold on; p(3) = plot(x,y2); hold on; h1 = legend(p(1:2),'reference','\bf{\theta}_2 = 5\cdot \theta_2'); set(h1,'interpreter','tex','location','northeast') nh = copyobj(h1,f); h2 = legend(p(3),'$\hat{\mathbf{\theta}}_2 = 5\cdot \mathbf{\theta}_2$'); set(h2,'interpreter','latex','location','southwest')
i'm afraid there no other in-matlab solution. i'd recommend save plot vector graphic , post process illustrator or inkscape.
Comments
Post a Comment