%% Customizing Tick Labels
% You can use graphics functions in MATLAB to modify tick labels on Cartesian and polar plots.
%
%% Tick Labels in Cartesian Coordinates
% Modify the tick labels of a Cartesian plot to better display the data. Create a plot that shows monthly temperature data over the course of a decade. Load the file monthlyTemps.mat, which contains the variables temperatures, months, and years. Visualize the yearly and monthly changes in a three-dimensional bar graph.

load('monthlyTemps.mat')

bar3(temperatures)
axis([0 13 0 12 0 80])

title('Monthly Temperatures 1990-2000')
xlabel('Month')
ylabel('Year')
zlabel('Temperature')

% The plot has the numbers 1 through 11 for the Year axis and the numbers 1 through 12 for the Month axis.
%
%% Customizing Tick Labels for X, Y, and Z
% Adjust the tick label properties to better display the information. Define tick labels by passing cell arrays of character vectors to the xticklabels and yticklabels functions.

xticklabels(months)
yticklabels(years)

% Angle the labels so that the text does not overlap. To adjust the angle of the tick labels, use the xtickangle and ytickangle functions.

xtickangle(-30)
ytickangle(30)

% The tick formatting functions change tick labels to fit a certain format, such as percentages or a type of currency. To add the degree symbol along the temperature axis labels, use the ztickformat function.

ztickformat('degrees')

%
%% Tick Labels in Polar Coordinates
% Similar to a Cartesian plot, you can modify the tick labels of a polar plot to better display the data.
% Create a plot that shows wind velocity data. Load the file windData.mat, which includes the variables direction, speed, humidity, C, and cardinal. Visualize the data on a polar scatter plot.

load('windData.mat')
polarscatter(direction,speed,humidity,C,'filled')

%
%% Customizing Tick Labels for R and Theta
% Adjust the radial tick labels with the r-axis tick label functions, such as rticks and rtickformat.

rticks([10 20])
rtickformat('%.2f')

% Change the theta tick labels with the theta-axis tick label functions, such as thetaticks and thetaticklabels.

thetaticks(0:45:360)
thetaticklabels(cardinal)

% Copyright 2012 The MathWorks, Inc.