Hello,
simply put, I have a figure in which I want to mark a certain YTickLabels as text, instead of value.
It all goes well, but by doing so, the exponent marker on the Y-Axis is gone. Forcing to set the value of 'Exponent' property of the YAxis doesn't work either. I guess it's because the Y-Axis ruler now has both number and text, so there is no proper scaling there.
I wonder if there is any workaround to this. Of course it is possible to add the exponent manually later, but I kind of want to have a procedural method for consistency.
The code below will demonstrate what I meant.
% Plot Data
figure(1);t = linspace(0,1,100);y = 0.005*sin(2*pi/0.01*t);plot(t,y);hold on;plot(xlim,[0 0],'k--');grid on;% Adding a line of interest
yval = 0.001;plot(xlim,[yval yval],'k-');hold off;% Modify YTicks to Min-Y, 0, YVal, Max-Y
yticks = get(gca,'YTick');yticks = sort([min(yticks),0,yval, max(yticks)],'ascend');% Modify YTickLabels
ylabels = get(gca,'YTickLabel');ylabels(3) = {'YVal'};set(gca,'YTickLabel', ylabels);set(get(gca,'YAxis'),'Exponent',-3); %--> This doesn't work now
Best Answer