home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

2 rows where user = 109167 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 2

  • issue 1
  • pull 1

state 1

  • closed 2

repo 1

  • xarray 2
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
2066367459 PR_kwDOAMm_X85jQuAO 8588 Update ecosystem.rst scls19fr 109167 closed 0     3 2024-01-04T21:34:24Z 2024-01-04T22:41:06Z 2024-01-04T22:41:03Z CONTRIBUTOR   0 pydata/xarray/pulls/8588

Related https://github.com/JuliaDataCubes/YAXArrays.jl/issues/354

  • [ ] Closes #xxxx
  • [ ] Tests added
  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [ ] New functions/methods are listed in api.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8588/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
137517563 MDU6SXNzdWUxMzc1MTc1NjM= 779 ENH: Mosaic plot and DataArray scls19fr 109167 closed 0     4 2016-03-01T09:16:52Z 2016-03-02T08:07:13Z 2016-03-02T08:07:13Z CONTRIBUTOR      

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

``` R

library(datasets) HairEyeColor , , Sex = Male

   Eye

Hair Brown Blue Hazel Green Black 32 11 10 3 Brown 53 50 25 15 Red 10 10 7 7 Blond 3 30 5 8

, , Sex = Female

   Eye

Hair Brown Blue Hazel Green Black 36 9 5 2 Brown 66 34 29 14 Red 16 7 7 7 Blond 4 64 5 8 ```

I can display a mosaic plot using R with the following example available thanks to ?HairEyeColor

``` R require(graphics)

Full mosaic

mosaicplot(HairEyeColor)

Aggregate over sex (as in Snee's original data)

x <- apply(HairEyeColor, c(1, 2), sum) x mosaicplot(x, main = "Relation between hair and eye color") ```

I get:

I try to produce a similar plot using Python.

I created xarray.DataArray using:

``` python import numpy as np import xarray

data = np.array([32, 53, 10, 3, 11, 50, 10, 30, 10, 25, 7, 5, 3, 15, 7, 8, 36, 66, 16, 4, 9, 34, 7, 64, 5, 29, 7, 5, 2, 14, 7, 8])

_dim = (4, 4, 2) data = data.reshape(_dim[::-1])

_dims = ['Hair', 'Eye', 'Sex'] _coords = [['Black', 'Brown', 'Red', 'Blond'], ['Brown', 'Blue', 'Hazel', 'Green'], ['Male', 'Female']]

data = xarray.DataArray( data, dims=_dims[::-1], coords=_coords[::-1], name='Number' )

assert int(data.loc['Female', 'Green', 'Black']) == 2 ```

and try to plot mosaic using:

python import matplotlib.pyplot as plt from statsmodels.graphics.mosaicplot import mosaic mosaic(data) plt.show()

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

``` python import numpy as np import xarray

data = np.array([ 0, 0, 35, 0, 0, 0, 17, 0, 118, 154, 387, 670, 4, 13, 89, 3, 5, 11, 13, 0, 1, 13, 14, 0, 57, 14, 75, 192, 140, 80, 76, 20])

_dim = (4, 2, 2, 2) data = data.reshape(_dim[::-1])

_dims = ['Class', 'Sex', 'Age', 'Survived'] _coords = [['1st', '2nd', '3rd', 'Crew'], ['Male', 'Female'], ['Child', 'Adult'], ['No', 'Yes']]

data = xarray.DataArray( data, dims=_dims[::-1], coords=_coords[::-1], name='Number' )

assert int(data.loc['Yes', 'Adult', 'Male', '3rd']) == 75 ```

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

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/779/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 18.501ms · About: xarray-datasette