Normally, pie charts are circular and each piece of data is shown as a slice of a whole.

However, for some purposes, it makes more sense to display the same kind of data as a rectangle divided up with vertical lines, with each horizontal "slice" of the rectangle representing a piece of the data.



Note that the intent of the above depiction is to have one long rectangle cut into 3 pieces. Two are 25% of the total rectangle and one is 50% of the rectangle.

Is there a package in Python or R that has can generate such a "rectangular" pie chart?


The term you are probably looking for is "mosaic chart" (alternatively, a "treemap").

A search through SO yields this question.

In R:

 mosaic(HairEyeColor, shade = TRUE)

First pic

Second pic

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.