www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/ControlNumberOfDecimalsForyAxisTickLabelsExample.m

    %% Control Number of Decimals for _y_-Axis Tick Labels
% Create a scatter plot of random data. Display the _y_-axis tick labels
% with two decimal places. Control the decimal places by passing
% |ytickformat| a character vector of a numeric format that uses
% fixed-point notation for the conversion character and a precision value
% of 2.

x = rand(30,1);
y = rand(30,1);
scatter(x,y);
ytickformat('%.2f')