MATLAB: How to draw line graph with same values in this bar graph

bar graphline plot

x = [1 2 3 4 5 6 7];
temp_high = [149.1350 143.9020 19.1230 19.0350 11.8150 19.8610 11.6600];
w1 = 0.5;
bar(x,temp_high,w1,'FaceColor',[0 0 1])
temp_low =[29.8270 28.7804 3.8246 3.8070 2.3630 3.9722 2.3320];
w2 = .25;
hold on
bar(x,temp_low,w2,'FaceColor',[1 0 0])
hold off
grid on
ylabel('Cost Incurred')
legend({'Units of gas consumed','cost incurred'},'Location','northwest')
ax = gca;
ax.XTick = [1 2 3 4 5 6 7];
ax.XTickLabels = {'Adding item to chain','Purchasing item from list','Shipment of item','Receiving item','Checking balance in user account','Fetching of item status','Total item count calculation'};
ax.XTickLabelRotation = 45;

Best Answer

clear
x = [1 2 3 4 5 6 7];
temp_high = [149.1350 143.9020 19.1230 19.0350 11.8150 19.8610 11.6600];
w1 = 0.5;
bar(x,temp_high,w1,'FaceColor',[0 0 1])
temp_low =[29.8270 28.7804 3.8246 3.8070 2.3630 3.9722 2.3320];
w2 = .25;
hold on
bar(x,temp_low,w2,'FaceColor',[1 0 0])
hold on
plot(x,temp_high,'b-','linewidth',2)
hold on
plot(x,temp_low,'r-','linewidth',2)
grid on
ylabel('Cost Incurred')
legend('Units of gas consumed','cost incurred','Units of gas consumed','cost incurred','Location','northwest')
ax = gca;
ax.XTick = [1 2 3 4 5 6 7];
ax.XTickLabels = {'Adding item to chain','Purchasing item from list','Shipment of item','Receiving item','Checking balance in user account','Fetching of item status','Total item count calculation'};
xtickangle(45)