home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 697814535 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 4

  • sdat2 2
  • dcherian 1
  • fmaussion 1
  • keewis 1

author_association 2

  • MEMBER 3
  • NONE 2

issue 1

  • Enhanced plotting option (latex backend and/or unit change) · 5 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
690371800 https://github.com/pydata/xarray/issues/4414#issuecomment-690371800 https://api.github.com/repos/pydata/xarray/issues/4414 MDEyOklzc3VlQ29tbWVudDY5MDM3MTgwMA== sdat2 30407294 2020-09-10T15:35:25Z 2020-09-10T15:58:29Z NONE

Hi @dcherian,

Thanks for the good idea! Changing the dataset that you want to plot is probably the easiest option.

Here is my implementation of that to go with my original code.

```python def change_ds_for_graph(dsA):

ds = dsA.copy()

for varname, da in ds.data_vars.items():
    for attr in da.attrs:
        if attr in ['units', 'long_name']:
            da.attrs[attr] = proper_units(tex_escape(da.attrs[attr]))

for coord in ds.coords:
    for attr in ds.coords[coord].attrs:
        if attr in ['units', 'long_name']:
            da.coords[coord].attrs[attr] = proper_units(tex_escape(da.coords[coord].attrs[attr]))

return ds

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Enhanced plotting option (latex backend and/or unit change) 697814535
690348123 https://github.com/pydata/xarray/issues/4414#issuecomment-690348123 https://api.github.com/repos/pydata/xarray/issues/4414 MDEyOklzc3VlQ29tbWVudDY5MDM0ODEyMw== dcherian 2448579 2020-09-10T14:59:25Z 2020-09-10T14:59:25Z MEMBER

The plotting routines use da.attrs["long_name"] and da.attrs["units"].

For publication figures, I set these manually when reading data: da.attrs["long_name"] = "$J_q^t$" and da.attrs["units"] = "$W/m²$". Every plot after that is then nicely labeled.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Enhanced plotting option (latex backend and/or unit change) 697814535
690327884 https://github.com/pydata/xarray/issues/4414#issuecomment-690327884 https://api.github.com/repos/pydata/xarray/issues/4414 MDEyOklzc3VlQ29tbWVudDY5MDMyNzg4NA== sdat2 30407294 2020-09-10T14:30:03Z 2020-09-10T14:30:03Z NONE

Hi @fmaussion and @keewis,

Thank you for your comments, I agree that these changes are opinionated, and so probably inappropriate for inclusion in xarray itself.

I guess my motivation was that I could not see a way to loop through the text in a graph and apply some function to it. It might be easier to directly apply these functions to the text before labelling, rather than changing the labels after they are written, but I hope that this will be possible by using the accessor syntax as you suggest.

A more general version of this issue would be a method to pass a list of text-sanitizing-functions to xarray.plot.

Thank you for linking to salem and pint-xarray, I hadn't discovered those packages before, hopefully I will find some useful functionality there.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Enhanced plotting option (latex backend and/or unit change) 697814535
690295612 https://github.com/pydata/xarray/issues/4414#issuecomment-690295612 https://api.github.com/repos/pydata/xarray/issues/4414 MDEyOklzc3VlQ29tbWVudDY5MDI5NTYxMg== keewis 14808389 2020-09-10T13:39:29Z 2020-09-10T13:39:29Z MEMBER

pint already supports printing units with latex, so you might be able to use pint and pint-xarray (and possibly cf-xarray for the definitions of degrees_north, etc.) in the future. See also xarray-contrib/pint-xarray#26.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Enhanced plotting option (latex backend and/or unit change) 697814535
690268138 https://github.com/pydata/xarray/issues/4414#issuecomment-690268138 https://api.github.com/repos/pydata/xarray/issues/4414 MDEyOklzc3VlQ29tbWVudDY5MDI2ODEzOA== fmaussion 10050469 2020-09-10T12:58:22Z 2020-09-10T12:58:22Z MEMBER

Thanks a lot for this suggestion! I'll let the others chime in as well, but there are a few things to consider here: - xarray's plotting capability is not meant to be "publication ready" but "as close as possible to the data". I.e. units like degrees_north, etc. have to stay like this because it unambiguously shows where the data came from and how users can access it from the file, etc. - in general, making the plots nicer with opinionated defaults like yours would be a nice addition to the xarray ecosystem. It could live in a separate package, and use the accessor syntax to extend xarray. For example, my own little extension works this way and does opinionated stuff with the accessor: https://salem.readthedocs.io

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Enhanced plotting option (latex backend and/or unit change) 697814535

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 1685.558ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows