home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where repo = 13221727 and user = 30407294 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

type 1

  • issue 1

state 1

  • closed 1

repo 1

  • xarray · 1 ✖
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
697814535 MDU6SXNzdWU2OTc4MTQ1MzU= 4414 Enhanced plotting option (latex backend and/or unit change) sdat2 30407294 closed 0     5 2020-09-10T11:32:15Z 2020-09-10T15:58:29Z 2020-09-10T14:30:04Z NONE      

One problem with xarray's default plotting functionality is that the plots look quite mediocre, and so if you want to present your results, then you may have to go in and change all the defaults, and relabel the graphs. This seems like wasted effort.

xarray could support pdflatex backend usage by matplotlib by sanitizing the labels.

It could also change units from degrees_north to the more presentable$^{\circ}$N.

An example of doing this is shown below:

``` import numpy as np import re import datetime import matplotlib import matplotlib.pyplot as plt import xarray as xr

def mpl_params(quality='high'): """ Apply my plotting style to produce nice looking figures. Call this at the start of a script which uses matplotlib, and choose the correct setting. :return: """ if quality == 'high': matplotlib.style.use('seaborn-colorblind') param_set = {"pgf.texsystem": "pdflatex", "text.usetex": True, "font.family": "serif", "font.serif": [], "font.sans-serif": ["DejaVu Sans"], "font.monospace": [], "lines.linewidth": 0.75, "pgf.preamble": [r"\usepackage[utf8x]{inputenc} \usepackage[T1]{fontenc}"] } else: matplotlib.style.use('seaborn-colorblind') param_set = {"text.usetex": False, "lines.linewidth": 0.75, "font.family": "sans-serif", "font.serif": [], "font.sans-serif": ["DejaVu Sans"], }

matplotlib.rcParams.update(param_set)

def tex_escape(text): """ It is better to plot in TeX, but this involves escaping strings. from: https://stackoverflow.com/questions/16259923/ how-can-i-escape-latex-special-characters-inside-django-templates :param text: a plain text message :return: the message escaped to appear correctly in LaTeX # removed unicode(key) from re.escape because this seemed an unnecessary, and was throwing an error. """ conv = { '&': r'\&', '%': r'\%', '$': r'\$', '#': r'#', '_': r'_', '{': r'{', '}': r'}', '~': r'\textasciitilde{}', '^': r'\^{}', '\': r'\textbackslash{}', '<': r'\textless{}', '>': r'\textgreater{}', } regex = re.compile('|'.join(re.escape(key) for key in sorted(conv.keys(), key=lambda item: - len(item)))) return regex.sub(lambda match: conv[match.group()], text)

def proper_units(text): conv = { 'degC': r'$^{\circ}$C', 'degrees_celsius': r'$^{\circ}$C', 'degrees_north': r'$^{\circ}$N', 'degrees_east': r'$^{\circ}$E', } regex = re.compile('|'.join(re.escape(key) for key in sorted(conv.keys(), key=lambda item: - len(item)))) return regex.sub(lambda match: conv[match.group()], text)

mpl_params(quality='high') ds = xr.tutorial.load_dataset('air_temperature') plot_data = ds.air.isel(time=120) plot = plot_data.plot(center=273.15, cbar_kwargs={'label': 'K'}) plt.title(tex_escape('time = '+ np.datetime_as_string(plot_data.coords['time'].data, unit='D'))) plt.xlabel(proper_units(tex_escape(ds.coords['lon'].long_name + ' [' + ds.coords['lon'].units + ']'))) plt.ylabel(proper_units(tex_escape(ds.coords['lat'].long_name + ' ['+ ds.coords['lat'].units + ']'))) plt.show()

```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4414/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

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

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 76.409ms · About: xarray-datasette