home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 405447950

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/2277#issuecomment-405447950 https://api.github.com/repos/pydata/xarray/issues/2277 405447950 MDEyOklzc3VlQ29tbWVudDQwNTQ0Nzk1MA== 6164157 2018-07-17T03:26:20Z 2018-07-17T03:26:20Z CONTRIBUTOR

I don't have an opinion about naming variables and would be happy with whatever decision y'all make.

For the code -- I added tests and changed the logic a bit. Following @dcherian's suggestion, now the default behavior is no longer coloring hues with discrete values (legend) but rather with a continuous scale (colorbar). It does make actually more sense and I think it should also be the default behavior for regular line plots. This is the API now:

python A = xr.DataArray(np.zeros([3, 20, 4, 4]), dims=[ 'x', 'y', 'z', 'w'], coords=[np.sort(np.random.randn(k)) for k in [3,20,4,4]]) ds=xr.Dataset({'A': A.x+A.y+A.z+A.w, 'B': -0.2/A.x-2.3*A.y-np.abs(A.z)**0.123+A.w**2}) ds.A.attrs['units'] = 'Aunits' ds.B.attrs['units'] = 'Bunits' ds.z.attrs['units'] = 'Zunits' ds.plot.scatter(x='A', y='B')

Specifying hue creates a colorbar: python ds.plot.scatter(x='A',y='B', hue='z') If, however, the hue dimension is not numeric, then a legend is created: python ds['z']= ['who', 'let','dog','out'] ds.plot.scatter(x='A',y='B', hue='z')

If you want a discrete legend even for numeric hues, you can specify it explicitly: python ds.plot.scatter(x='A',y='B', hue='w', discrete_legend=True)

I am a bit bothered by the fact that this is not only a different coloring method, it's a very different style altogether (under the hood using plot instead of scatter). I don't know if it's a good thing or a bad thing that the same function can produce very different looking figures. Input will be welcome about that.

Of course, faceting works as you think it should: python ds.plot.scatter(x='A',y='B', hue='z',col='x') ds.plot.scatter(x='A',y='B', hue='w',col='x', col_wrap=2)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  340069538
Powered by Datasette · Queries took 0.653ms · About: xarray-datasette