I have made a plot in Matlab, using:
hold on
plot(t1,Dx1,'r')
xlabel('t (ps)')
ylabel('Deviation of coordinate from initial coordinate (Å)')
plot(t1,Dy1,'g')
plot(t1,Dz1,'b')
hold off
However, the tick labels on the y axis are generated in scientific notation:
Is there any way I can remove the scientific notation and just have the y labels range from -0.0025 to 0.0005? Thanks!
you can use "format short g" command in the start of the code. I am a fresher in matlab but as far as i know it can help to get rid of e in the answer.
First of all, create a vector and its plot using plot function. Then, use options(scipen=999) to remove scientific notation from the plot.
Direct link to this answerTickLength = [0 0]; This will allow you to keep the labels but remove the tick marks on only the x-axis.
xticks( ticks ) sets the x-axis tick values, which are the locations along the x-axis where the tick marks appear. Specify ticks as a vector of increasing values; for example, [0 2 4 6] . This command affects the current axes. xt = xticks returns the current x-axis tick values as a vector.
You could try to manually set the tick labels yourself using sprintf:
yt = get(gca,'YTick');
set(gca,'YTickLabel', sprintf('%.4f|',yt))
Try adding this after creating the axes:
ax = gca;
ax.YAxis.Exponent = 0;
Here is an example:
x = 0:0.1:10;
y = 1000*x.^2;
%Plot with default notation:
subplot(1,2,1)
plot(x,y)
%Plot without exponent:
subplot(1,2,2)
plot(x,y)
ax = gca
ax.YAxis.Exponent = 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With