-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Mosaic plot and DataArray #779
Comments
Interesting -- I haven't encountered mosaic plots before. If it's as simple as writing |
Mosaic plots are not so rare and widely used for categorical display. |
Hello,
I'd like to draw using Python a similar mosaic plot (also named Marimekko chart) of R dataset
HairEyeColor
.https://github.com/wch/r-source/blob/trunk/src/library/datasets/data/HairEyeColor.R
Here is R code
I can display a mosaic plot using R with the following example available thanks to
?HairEyeColor
I get:
I try to produce a similar plot using Python.
I created
xarray.DataArray
using:and try to plot mosaic using:
I get:
I think there is some room for improvements.
Providing a
da.plot.mosaic
method may be a first feature.Using labels will be an other interesting feature.
Kind regards
PS: a similar mosaic plot can be plot using Titanic dataset
https://github.com/wch/r-source/blob/trunk/src/library/datasets/data/Titanic.R
with R
with Python
PS2: Python/xarray datasets are available at https://github.com/Rdatasets/python
PS3: mosaic code can be found here:
https://github.com/statsmodels/statsmodels/blob/master/statsmodels/graphics/mosaicplot.py
https://github.com/statsmodels/statsmodels/blob/master/statsmodels/graphics/tests/test_mosaicplot.py
The text was updated successfully, but these errors were encountered: