File Exchange

image thumbnail

MATLAB Plot Gallery - Stacked Bar Chart

Create a stacked bar chart


Updated 01 Sep 2016

View License

This is an example of how to create a stacked bar chart in MATLAB®.
Read about the "bar" function in the MATLAB documentation.
For more examples, go to MATLAB Plot Gallery -

Comments and Ratings (3)

Timur Kelin

1. The order of of the colours on the bars and on the legend is opposed. This doesn't look nice.
2. Irrespective to this example: 'stack' doesn't work for a stacked single bar. Fake data for the second bar should be added to the input data.

Serena Todd



Updated license

Updated screenshot.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Inspired: superbar

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor