# Converting Y-axis values to the base of 10

2 views (last 30 days)
Parisa Afkari on 26 Nov 2022
Answered: Star Strider on 26 Nov 2022
Hi,
I have a below code which gave me a plot like what I attached:
%importing data
t_fluide= data_fluide_ac220(:,1);
dilution=data_fluide_ac220(:,13);
t_fluide_ac225 = data_fluide_ac225(:,1);
dilution_ac225=data_fluide_ac225(:,13);
t1=t_fluide;
y1= log(dilution);
t2= t_fluide_ac225;
y2= log(dilution_ac225);
figure(1)
fitobject1 = fit(t1,y1,'poly3');
fitobject2=fit(t2,y2,'poly3');
plot (fitobject1)
hold on
plot (fitobject2)
hold off
But now I want to convert the value of Y-axis to go to the basis of 10 and my Y-axis be like 10^-6, 10^-5,....,10^0,10^1.
I tried many things but could not find a good solution. I appreciate if anyone have aan experience with this.
Thank you
Parisa

Star Strider on 26 Nov 2022
This can be done easily using ytickformat (introduced in R2016b) —
x = linspace(0, 2.5);
y = 6*exp(-1.5*x) - 6;
figure
plot(x, y)
ytickformat('10^{%2d}') % Set Format
.