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

    %% Display _y_-Axis Tick Labels in Dollars
% Display the _y_-axis tick labels in dollars with and without decimal
% values.
%
% Create a bar chart. Display the tick labels along the _y_-axis in 
% dollars.

x = 0:20:100;
y = [88 67 98 43 45 65];
bar(x,y)
ytickformat('usd')

%%
% Query the tick label format. MATLAB(R) returns the format as a character
% vector containing the formatting operators.

fmt = ytickformat


%%
% Display the tick labels with no decimal values by tweaking the numeric
% format to use a precision value of 0 instead of 2. 

ytickformat('$%,.0f')