stackedbar(x=None, values=None, colors=None, labels=None, transpose=False, flipud=False, is_cum=False, barh=False, **kwargs)[source]#

Create a stacked bar chart.

  • x (array) – the x coordinates of the values

  • values (array) – the 2D array of values to plot as stacked bars

  • colors (list/arr) – the color of each set of bars

  • labels (list) – the label for each set of bars

  • transpose (bool) – whether to transpose the array prior to plotting

  • flipud (bool) – whether to flip the array upside down prior to plotting

  • is_cum (bool) – whether the array is already a cumulative sum

  • barh (bool) – whether to plot as a horizontal instead of vertical bar

  • kwargs (dict) – passed to


values = pl.rand(3,5)
sc.stackedbar(values, labels=['bottom','middle','top'])

New in version 2.0.4.