How to draw bar graph of different colors ?
Show older comments
I have plotted the bar graph but the color is same. i want to differentiate the color of each x variable .Thank you in advance !

1 Comment
darova
on 26 Feb 2021
What about using patch?
Accepted Answer
More Answers (1)
Adam Danz
on 26 Feb 2021
1 vote
This has been addressed in the forum many times.
Examples:
- https://www.mathworks.com/matlabcentral/answers/553894-barcharts-colours-based-on-other-vectors#answer_456622
- https://www.mathworks.com/matlabcentral/answers/571735-custom-colors-for-stacked-bar-chart#answer_471967
- https://www.mathworks.com/matlabcentral/answers/486175-how-can-i-change-colors-and-generate-errorbars-in-a-bar-graph#answer_397071
- https://www.mathworks.com/matlabcentral/answers/506415-bar-chart-legend-and-colour
- https://www.mathworks.com/matlabcentral/answers/599512-changing-transparency-of-individual-bars-in-bar#answer_500116
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!
