www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/ChangeExponentValueForYAxisExample.m
%% Change Exponent Value for y-Axis Tick Labels % This example shows how to change the value displayed in the % exponent label at the top of the _y_-axis. %% % Plot data with _y_ values that range between -15,000 and 15,000. By % default, the _y_-axis tick labels use exponential notation with an % exponent value of 4 and a base of 10. x = linspace(0,5,1000); y = 100*exp(x).*sin(20*x); plot(x,y) %% % Change the exponent value to 2. Set the |Exponent| property of the % numeric ruler associated with the _y_-axis. Access the numeric ruler % through the |YAxis| property of the axes object. The exponent label and % the tick labels change accordingly. ax = gca; ax.YAxis.Exponent = 2; %% % Change the exponent value to 0 so that the tick labels do not use % exponential notation. ax.YAxis.Exponent = 0; %% % Change the exponent back to the default value by setting the associated % mode property back to automatic. ax.YAxis.ExponentMode = 'auto';