home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

12 rows where issue = 948049609 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 5

  • Illviljan 7
  • mathause 2
  • pep8speaks 1
  • TomNicholas 1
  • github-actions[bot] 1

author_association 3

  • MEMBER 10
  • CONTRIBUTOR 1
  • NONE 1

issue 1

  • Replace dataset scatter with the dataarray version · 12 ✖
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
882880469 https://github.com/pydata/xarray/pull/5622#issuecomment-882880469 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X840n6_V github-actions[bot] 41898282 2021-07-19T21:41:24Z 2022-01-07T06:50:03Z CONTRIBUTOR

Unit Test Results

5 files           5 suites   40m 26s :stopwatch: 16 290 tests 14 546 :heavy_check_mark: 1 739 :zzz:   5 :x: 75 780 runs  68 978 :heavy_check_mark: 6 777 :zzz: 25 :x:

For more details on these failures, see this check.

Results for commit 48c0cde5.

:recycle: This comment has been updated with latest results.

{
    "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
882879460 https://github.com/pydata/xarray/pull/5622#issuecomment-882879460 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X840n6vk pep8speaks 24736507 2021-07-19T21:39:25Z 2022-01-07T06:49:48Z NONE

Hello @Illviljan! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

  • In the file xarray/plot/plot.py:

Line 19:1: F401 '.utils._adjust_legend_subtitles' imported but unused Line 19:1: F401 '.utils._legend_add_subtitle' imported but unused Line 19:1: F401 '.utils.legend_elements' imported but unused

Comment last updated at 2021-11-05 06:38:18 UTC
{
    "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
983728169 https://github.com/pydata/xarray/pull/5622#issuecomment-983728169 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X846ooAp mathause 10194086 2021-12-01T15:02:59Z 2021-12-01T15:02:59Z MEMBER

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

{
    "total_count": 1,
    "+1": 1,
    "-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
890044593 https://github.com/pydata/xarray/pull/5622#issuecomment-890044593 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X841DQCx mathause 10194086 2021-07-30T17:29:24Z 2021-07-30T17:29:24Z MEMBER

Would be easy if we could just force named arguments?

Yes that would be a good idea. A deprecation would be nice but for the backends refactor (open_dataset) this directly became an error.

For example an acccidentally inverted plot didn't crash the tests.

Good you noticed - I also think the plotting tests are not comprehensive.

{
    "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
886869099 https://github.com/pydata/xarray/pull/5622#issuecomment-886869099 https://api.github.com/repos/pydata/xarray/issues/5622 IC_kwDOAMm_X8403Ixr TomNicholas 35968931 2021-07-26T16:58:23Z 2021-07-26T16:58:23Z MEMBER

My 2 cents:

How important is the argument order for the plotting functions?

Obviously it would be nice to be able to get the arguments in the same order across functions, but I think we probably care more about not suddenly breaking backwards compatibility - any change to the order should technically require a deprecation cycle... That said standardizing something more consistent would be good.

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.

Not really sure what the best thing to do is.

We seem to be lacking tests regarding how the plot should look like.

My understanding is that testing the displayed output of plotting functions is notoriously tricky and unreliable, hence when we currently test we interrogate properties of matplotlib objects. There are libraries that check images are correct, and @pytest.mark.flaky helps, but I'm not sure if it's worth it. Also we are merely wrapping matplotlib here - if we make efforts to check that the objects' properties are as expected then at some level we obviously have to trust that that corresponds to the same image.

For example an acccidentally inverted plot didn't crash the tests.

Is there no obvious object property test that would have caught this?

{
    "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 14.778ms · About: xarray-datasette