home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where author_association = "MEMBER", issue = 948049609 and user = 14371165 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 1

  • Illviljan · 7 ✖

issue 1

  • Replace dataset scatter with the dataarray version · 7 ✖

author_association 1

  • MEMBER · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1159477493 https://github.com/pydata/xarray/pull/5622#issuecomment-1159477493 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X85FHDj1 Illviljan 14371165 2022-06-18T14:48:36Z 2022-06-18T14:48:36Z MEMBER

pre-commit.ci autofix

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 1,
    "eyes": 0
}
  Replace dataset scatter with the dataarray version 948049609
1018993772 https://github.com/pydata/xarray/pull/5622#issuecomment-1018993772 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X848vJxs Illviljan 14371165 2022-01-22T00:40:23Z 2022-01-22T00:40:23Z MEMBER

Line plots aren't completely broken now. The array is being stacked to 1 dim now. Using nan to split the lines at appropriate places.

```python ds = xr.tutorial.scatter_example_dataset(seed=42) hue_ = "y" x_ = "y" size_="y" z_ = "z" fig = plt.figure() ax = fig.add_subplot(1, 2, 1, projection='3d') ds.A.sel(w="one").plot.line(x=x_, z=z_, hue=hue_, linewidth=size_, ax=ax) ax = fig.add_subplot(1, 2, 2, projection='3d') ds.A.sel(w="one").plot.scatter(x=x_, z=z_, hue=hue_, markersize=size_, ax=ax) ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Replace dataset scatter with the dataarray version 948049609
1008210008 https://github.com/pydata/xarray/pull/5622#issuecomment-1008210008 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X848GBBY Illviljan 14371165 2022-01-09T01:47:20Z 2022-01-09T01:47:20Z MEMBER

Gotten a little sidetracked with line plots for a while now. I'm annoyed that all the primitives are different for each plotting type, e.g Collections, Line2D, list of Line2D, etc. It makes it hard to use similar code paths. So I've been trying out LineCollection a little which behaves very similarly to ax.scatter. Being able to use hue and size the same way as in scatter seems like a big improvement to me.

In the example below you can clearly see that we have two curves where the hue changes somehow over time. But I'm having trouble understanding how to determine what's supposed to be a line. For example if x and y were 4d arrays how should it be split? scatter uses ravel to get around these hard questions. Maybe you can ravel just certain dimensions?

Like if y(a,b,c,d) and x(a, b) maybe you can * ravel along a,b and create a single line * Will this require sorting as unsorted lines usually looks bad? Does it make sense at that point? * new lines will be generated along remaining dims; c, d. * How do you label these new lines, since color and linewidth can now be used along lines as well? Using linestyle along c? Those are finite though. And what about the d dim and possibly other remaining dims? Maybe they should just remain a mystery? You probably could play around with hue or size to see those changes.

Not sure how to do that in xarray though. Thoughts, ideas or other examples are appreciated.

```python import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.dates as mdates import numpy as np from matplotlib.collections import LineCollection import numpy as np np.random.seed(42) dates = np.arange("2017-01-01", "2017-06-20", dtype="datetime64[D]" ) y = np.cumsum(np.random.normal(size=len(dates))) y2 = np.cumsum(np.random.normal(size=len(dates))) c = np.cumsum(np.random.normal(size=len(dates))) c2 = np.cumsum(np.random.normal(size=len(dates))) s = 1 + np.minimum(np.cumsum(np.random.normal(size=len(dates))), 0) s2 = 1 + np.minimum(np.cumsum(np.random.normal(size=len(dates))), 0) fig, ax = plt.subplots() #convert dates to numbers first inxval = mdates.date2num(dates) points = np.array([inxval, y]).T.reshape(-1,1,2) segments = np.concatenate([points[:-1],points[1:]], axis=1) lc = LineCollection(segments, cmap="plasma", linewidth=s) lc.set_array(c) p = ax.add_collection(lc) points2 = np.array([inxval, y2]).T.reshape(-1,1,2) segments2 = np.concatenate([points2[:-1],points2[1:]], axis=1) lc2 = LineCollection(segments2, cmap="plasma", linewidth=s2) lc2.set_array(c2) p = ax.add_collection(lc2) fig.colorbar(p, ax=ax) ax.xaxis_date() ax.autoscale_view() plt.show() ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Replace dataset scatter with the dataarray version 948049609
984071123 https://github.com/pydata/xarray/pull/5622#issuecomment-984071123 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X846p7vT Illviljan 14371165 2021-12-01T21:29:42Z 2021-12-01T21:40:17Z MEMBER

Not sure if this is too naïve from my side but can you just pass N+1 levels to the function?

Pretty much what I did. ["a", "b", "c"] is converted to [1, 3, 5]. The discrete colors/levels are bounded by [(0, 2), (2, 4), (4, 6)]. This way the ticks will be put nicely in the middle of the discrete color.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Replace dataset scatter with the dataarray version 948049609
981065902 https://github.com/pydata/xarray/pull/5622#issuecomment-981065902 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X846eeCu Illviljan 14371165 2021-11-28T11:11:00Z 2021-11-28T11:11:00Z MEMBER

I'm struggling getting categorical colorbars to work nicely:

```python import numpy as np import xarray as xr das = [ xr.DataArray( np.random.randn(3, 3, 4, 4, 2), dims=["x", "row", "col", "hue", "size"], coords=[range(k) for k in [3, 3, 4, 4, 2]], ) for _ in [1, 2] ] ds = xr.Dataset({"A": das[0], "B": das[1]}) ds.hue.name = "huename" ds.hue.attrs["units"] = "hunits" ds.x.attrs["units"] = "xunits" ds.col.attrs["units"] = "colunits" ds.row.attrs["units"] = "rowunits" ds.A.attrs["units"] = "Aunits" ds.B.attrs["units"] = "Bunits" ds2 = ds.copy() ds2["hue"] = ["d", "a", "c", "b"] g = ds2.plot.scatter( x="A", y="B", hue="hue", markersize="size", col="col", add_legend=True, add_colorbar=True, ) ```

My goals are: * 4 colors for 4 categories * ticks should be centered on the color.

One of the issues are that https://github.com/pydata/xarray/blob/135a3351bf77a4a55e76a8c60b40852ec10cdd4a/xarray/plot/utils.py#L69 Seems to be focused on contour(f) plots only which leads to the colorbar having N-1 colors all the time.

Any ideas how to solve this is appreciated.

Related links: * https://stackoverflow.com/questions/14777066/matplotlib-discrete-colorbar * https://gist.github.com/jakevdp/8a992f606899ac24b711

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Replace dataset scatter with the dataarray version 948049609
887055377 https://github.com/pydata/xarray/pull/5622#issuecomment-887055377 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X84032QR Illviljan 14371165 2021-07-26T22:00:14Z 2021-07-26T22:00:14Z MEMBER

The scatter tests doesn't seem to make sure x,y values are plotted as expected. I was testing the test cases for other reasons and noticed that the x and values were opposite. You can check the x and y values are returned in the expected order with something like this: python fig, ax = plt.subplots(1,1) p = ax.plot([1, 2], [3, 4]) p[0].get_data() Out[12]: (array([1, 2]), array([3, 4])) Something similar can probably be done with hue and size as well so there shouldn't be any need for the tricky display tests.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Replace dataset scatter with the dataarray version 948049609
886264499 https://github.com/pydata/xarray/pull/5622#issuecomment-886264499 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X84001Kz Illviljan 14371165 2021-07-25T22:09:37Z 2021-07-25T22:09:37Z MEMBER

Good idea to keep the dataarray scatter non-public for now, found quite a few bugs there. :) Turned out a little trickier than expected to get the tests passing, I'll continue pondering this next week.

Some thoughts before I forget them: * How important is the argument order for the plotting functions? It's been very difficult getting the line plot and scatter to behave the same because they have completely different order of inputs. Would be easy if we could just force named arguments? * How important are figure legends in facetgrid? Some tests breaks on this now but I'm not sure it's a good idea to change to figlegends instead of legend per plot. * We seem to be lacking tests regarding how the plot should look like. For example an acccidentally inverted plot didn't crash the tests.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Replace dataset scatter with the dataarray version 948049609

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 31.367ms · About: xarray-datasette