Add cut line (horizontal line) in bar graph
Show older comments
Hello everybody.
I just made a bar graph using the bar function, but I want a horizontal line to appear on the x axis. I know the xline function exists, but my MATLAB version appears to be old. Below I show the simple code.
x = [3.10,8.17,9.84,4.71,1.43,6.90,3.70,10.24,9.61,5.92,4.51,7.12,2.99,4.73,5.96,9.58,7.22,4.91,4.80,8.79,8.45,6.38,2.83,1.10,7.47,5.36,10.42,5.11,5.15,4.25,7.65,7.05,3.60,4.08,7.29,4.72,4.90,8.74,5.42,9.96,4.88,4.06,4.68,6.67,4.16,6.20,7.34,2.96,7.16,6.34,9.20,4.66,7.42,3.32,8.45,5.59,4.97,5.50,6.20,1.30,3.84,3.97,7.98,6.71,5.26,6.39,6.24,9.19,9.27,4.63,7.20,7.45,4.94,7.57,6.79,8.58,6.51,5.98,5.44,5.47,6.67,5.33,7.59,5.82,4.24,2.86,3.14,4.93,4.15,4.58,7.20,5.33,4.17,6.30];
bar(x,0.8,'w');
ylabel('volume')
xlabel('Pacients')
xticks([1:94]);
yticks([1:11]);
Accepted Answer
More Answers (1)
Duijnhouwer
on 30 Jun 2020
Edited: Duijnhouwer
on 30 Jun 2020
hold on
plot(xlim,[5 5],'r-','LineWidth',2)
1 Comment
Dionisio Mendoza
on 1 Jul 2020
Categories
Find more on Discrete Data Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!