1

Background There are several questions addressing how one can plot 3D data on a 3D plot using matplotlib. Such as Link 1 and Link 2

What I want is, a 3D looking stacked bar chart using a 2D data. Such stacked plots can be created using other tools conveniently (LibreOffice Calc) e.g.


3D looking stacked barchart produced using LibreOffice Calc.


Problem

How can I produce similar 3D effect using Matplotlib in a 2D plot. I have produced a 2D stacked barchart using Matplotlib as shown below

Stacked Bar Chart 2D looks

To be specific, I am looking to get information regarding packages/tools/themes/options that would allow me to achieve this in a 2D plot environment.


Additional information

  1. Generalized code used to produce this 2D plot is as follows:

    ax.bar(X, Y1, alpha=1, label="Y1", hatch='/', color='r')
    ax.bar(X, Y2, bottom=Y1, alpha=1, label="Y2", color='g', hatch='.')
    ax.bar(X, Y3, bottom=Y1+Y2, alpha=1, label="Y3", hatch='\\', color='b')
    
  2. Data used to create this is given

here

  1. Using Link 2, by setting the y-axis to be constant, I have produced the following plot (Thanks to the community members for helping me in refining the question)

3D plot by setting Y-axis to be constant

Neeraj Hanumante
  • 1,575
  • 2
  • 18
  • 37

0 Answers0