4

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.

Bicycle,25%
Plane,25%
Car,50%


________________________________________________
|_Bicycle__|____Plane___|_________Car___________|

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?

1

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

A search through SO yields this question.

In R:

 require("vcd")
 data(HairEyeColor)
 mosaic(HairEyeColor, shade = TRUE)

First pic

Second pic

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.