Search code examples
matlabmatlab-figure

subscript doesnot work in set function


I want to use SL as a subscript. Why it doesn't work with set function? how should I write the code?

w=figure;
Labels={'E-O_{SL}','R','E','S','O','P','Sw','Lu'};
x=[1:8];
y=[0.81 0.78 0.79 0.92 0.81 0.46 0.89 0.86];
bar(x,y,'FaceColor',[0.360 0.50 0],'BarWidth',0.8);
set(gca,'xticklabel',Labels,'FontSize',8);
ylabel('Precision','FontSize',11);
set(w, 'Position', [0 0 800, 800]);
ylim([0 1]);

Thanks


Solution

  • Assuming this is what you want, your code works just fine in MATLAB 2015b.

    enter image description here