%% Overlay Line Plot on Bar Graph Using Different y-Axes
% This example shows how to combine a line plot and a bar graph using two different  y-axes.
% Define the concentration and temperature data collected every 5 days for a 35 day period.

days = 0:5:35;
conc = [515 420 370 250 135 120 60 20];
temp = [29,23,27,25,20,23,23,27];

%
% Use plotyy to display a bar graph of the temperature data and a line graph of the concentration data. Return the two axes in array ax, the bar graph as b, and the line plot as p.

[ax,b,p] = plotyy(days,temp,days,conc,'bar','plot');

%
% Add a title and axis labels to the graph. Use the axes to label the left and right y-axis appropriately.

title('Trend Chart for Concentration')
xlabel('Day')
ylabel(ax(1),'Temperature (^{o}C)')
ylabel(ax(2),'Concentration')

%
% Change the line width and color. Starting in R2014b, you can use dot notation to set properties. If you are using an earlier release, use the set function instead.

p.LineWidth = 3;
p.Color = [0,0.7,0.7];

% The graph uses two different y-axes. The left y-axis corresponds to the bar graph. The right y-axis corresponds to the line plot.
% Copyright 2012 The MathWorks, Inc.