Skip to content

Feature Request: multiple stacked bars #14086

Closed as not planned
Closed as not planned
@busiing

Description

@busiing

Summary

I am looking for a one-call way to plot multiple stacked bars in one chart by giving it a 2D-Matrix for the y-axis.

This feature request is similar to #11048, where the bars are placed next to each other.

The documentation for matplotlib.pyplot.bar just allows scalar or array-like inputs.

The data used contains 2 x 8760 timesteps (hours). ATM I work with stackplot to generate the following graphs. Just the third graph is relevant to this issue.

Figure_1

My workaround would be to use stackplot for a lineplot:
`ax1.stackplot(x,y, labels=labels)
and duplicate the data in 'y' - shift the duplication just a second before the next timestep (hour) and merge those sets.

Expected outcome
I found a function that fits my problem but is not scalable for bigger arrays. (creation time is long and editing the view takes forever) But the bars in this case have a gap between the bars. I am looking for a way to adjust the width, so the gaps can be closed.
I think the value and x-axis labels are responsible for the long calculation, but I am not sure.

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.03
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version: 3.6.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions