MATLAB Answers


How to put a multiple on the y-axis top in plot figure?

Asked by Muhammad
on 14 Nov 2013
Latest activity Answered by Walter Roberson
on 14 Nov 2013

I am plotting two vectors using the command plot(x,y). However, I want to have a constant multiple to be put at the top of axis in the plot figure.

For example, I need to plot values of y along y-axis. If y = [1000 2000 3000 4000 5000] and y' = [1 2 3 4 5], I use the command plot(x,y'). Then in the plot figure, I want to put a small text at top of axis saying 10^3.

Remember, I don't want to multiply the y-axis with 10^3 but to put just a text at top of the axis.


I guess this is done automatically by Matlab.

Yes if the number is very big then MATLAB does it. But if the numbers are very small, how could you do this manually?

Log in to comment.


1 Answer

Answer by Walter Roberson
on 14 Nov 2013

MATLAB will do this automatically for large or small values, but there is no documented method of turning on the behavior automatically. Therefore you will need to text() the multiple into place, and adjust the ylabels property of the axis to have the strings you want to use.


Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!