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

    %% Control Number of Decimals Displayed
% After creating a scatter plot, display the _x_-axis tick labels with two decimal
% places. Control the decimal places by passing |xtickformat| a
% character vector of a numeric format that uses fixed-point notation for
% the conversion character and a precision value of 2.

x = linspace(0,1,100);
y = randn(1,100).*cos(x);
scatter(x,y)
xtickformat('%.2f')