home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where issue = 755105132 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 4

  • astoeriko 3
  • shoyer 2
  • keewis 1
  • ahuang11 1

author_association 3

  • MEMBER 3
  • NONE 3
  • CONTRIBUTOR 1

issue 1

  • Wrong hue assignment in scatter plot · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
749323873 https://github.com/pydata/xarray/issues/4641#issuecomment-749323873 https://api.github.com/repos/pydata/xarray/issues/4641 MDEyOklzc3VlQ29tbWVudDc0OTMyMzg3Mw== ahuang11 15331990 2020-12-22T03:55:33Z 2020-12-22T03:55:33Z CONTRIBUTOR

Maybe a simple fix would be to replace np.unique with pd.unique since it's ordered? ``` Hash table-based unique. Uniques are returned in order of appearance. This does NOT sort.

Significantly faster than numpy.unique. Includes NA values. ```

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.unique.html

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Wrong hue assignment in scatter plot 755105132
749250751 https://github.com/pydata/xarray/issues/4641#issuecomment-749250751 https://api.github.com/repos/pydata/xarray/issues/4641 MDEyOklzc3VlQ29tbWVudDc0OTI1MDc1MQ== keewis 14808389 2020-12-21T23:22:11Z 2020-12-21T23:22:11Z MEMBER

this is caused by the use of np.unique here: https://github.com/pydata/xarray/blob/de3f27553fd480e247a3f1f7d377fec0f5f2759c/xarray/plot/dataset_plot.py#L425 to fix that, I think we either need to find a way to preserve the order of data["hue"] (the output of np.unique is sorted), or we have to use sorted/np.unique here: https://github.com/pydata/xarray/blob/de3f27553fd480e247a3f1f7d377fec0f5f2759c/xarray/plot/facetgrid.py#L384

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Wrong hue assignment in scatter plot 755105132
746969091 https://github.com/pydata/xarray/issues/4641#issuecomment-746969091 https://api.github.com/repos/pydata/xarray/issues/4641 MDEyOklzc3VlQ29tbWVudDc0Njk2OTA5MQ== shoyer 1217238 2020-12-16T20:33:08Z 2020-12-16T20:33:08Z MEMBER

Ugh, this is unfortunate! Thanks for the clear example code. Coincidentally, one of collaborators ran into this same bug this morning. This sort of "corrupted data" bug is one of the nastiest types, so we should definitely try to prioritize a fix.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Wrong hue assignment in scatter plot 755105132
737853069 https://github.com/pydata/xarray/issues/4641#issuecomment-737853069 https://api.github.com/repos/pydata/xarray/issues/4641 MDEyOklzc3VlQ29tbWVudDczNzg1MzA2OQ== astoeriko 42246615 2020-12-03T10:31:33Z 2020-12-03T10:42:32Z NONE

Here are the plots demonstrating what I mean.

The “upright” rectangle (in the intervals [0, 0.5] and [0, 2]) of points represents the data corresponding to category "A". However, it is colored in blue, which corresponds to category "B". The order of labels in the legend is correct in the sense that it conserves the order in the Dataset.

In the second image, the color assignment in the plot is correct – data corresponding to category "A" is still colored in blue but that now corresponds to category "A". The legend is now alphabetically ordered instead of conserving the order the category coordinate in the Dataset.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Wrong hue assignment in scatter plot 755105132
737617144 https://github.com/pydata/xarray/issues/4641#issuecomment-737617144 https://api.github.com/repos/pydata/xarray/issues/4641 MDEyOklzc3VlQ29tbWVudDczNzYxNzE0NA== shoyer 1217238 2020-12-03T02:18:20Z 2020-12-03T02:18:20Z MEMBER

could you share an image showing what the incorrect plot(s) looks like? you should be able to "paste" into the comment field in GitHub

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Wrong hue assignment in scatter plot 755105132
737190620 https://github.com/pydata/xarray/issues/4641#issuecomment-737190620 https://api.github.com/repos/pydata/xarray/issues/4641 MDEyOklzc3VlQ29tbWVudDczNzE5MDYyMA== astoeriko 42246615 2020-12-02T12:09:48Z 2020-12-02T12:09:48Z NONE

As my original plot still was wrong after updating I investigated a bit further: The problem persists when also faceting. Here is my new example where, again, data of category "A" get colored as "B" and vice versa. ```python import xarray as xr import numpy as np

u = np.random.rand(50, 2, 2) * np.array([1, 2]) v = np.random.rand(50, 2) * np.array([1, 0.5])

ds = xr.Dataset( { "u": (("x", "foo", "category"), u), "v": (("x", "category"), v), }, coords={"category": ["B", "A"], "foo": [1, 2]} )

g = ds.plot.scatter( y="u", x="v", hue="category", col="foo" ); ``` I am sorry for the confusion.

Output of `xr.show_versions()` INSTALLED VERSIONS ------------------ commit: None python: 3.7.8 | packaged by conda-forge | (default, Nov 27 2020, 19:24:58) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 4.15.0-122-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.16.2 pandas: 1.1.2 numpy: 1.17.5 scipy: 1.5.3 netCDF4: 1.5.4 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: 2.4.0 cftime: 1.3.0 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.26.0 distributed: 2.30.1 matplotlib: 3.3.2 cartopy: None seaborn: 0.11.0 numbagg: None pint: None setuptools: 49.6.0.post20201009 pip: 20.3 conda: 4.8.3 pytest: 6.0.1 IPython: 7.19.0 sphinx: None
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Wrong hue assignment in scatter plot 755105132
737127510 https://github.com/pydata/xarray/issues/4641#issuecomment-737127510 https://api.github.com/repos/pydata/xarray/issues/4641 MDEyOklzc3VlQ29tbWVudDczNzEyNzUxMA== astoeriko 42246615 2020-12-02T10:05:21Z 2020-12-02T10:05:21Z NONE

After updating xarray to 0.16.2, the colors in the plot agree with the colors in the legend, so the error indicated above does not persist. We can probably close this issue. However, this seems to be achieved not by changing the colors in the plot but by sorting the legend as well. That is, the order of the category variable in the legend is ["A", "B"], although I specified it to be ["B", "A"] in the dataset. I am not sure if this is an intended behaviour?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Wrong hue assignment in scatter plot 755105132

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 15.164ms · About: xarray-datasette