%% 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.

% Copyright 2015 The MathWorks, Inc.


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
% <docid:matlab_ref.f67-432995> 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.