home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

1 row where "closed_at" is on date 2021-06-23, comments = 14 and user = 35968931 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

  • pull 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
404945709 MDExOlB1bGxSZXF1ZXN0MjQ5MDE0MTc3 2729 [WIP] Feature: Animated 1D plots TomNicholas 35968931 closed 0     14 2019-01-30T20:15:52Z 2021-06-24T08:46:31Z 2021-06-23T16:14:28Z MEMBER   0 pydata/xarray/pulls/2729

This is an attempt at a proof-of-principle for making animated plots in the way I suggested in #2355. (Also relevant for #2030.)

This example code: ```python import matplotlib.pyplot as plt import xarray as xr

Load data as done in plotting tutorial

airtemps = xr.tutorial.open_dataset('air_temperature') air = airtemps.air - 273.15 air.attrs = airtemps.air.attrs air.attrs['units'] = 'deg C'

Downsample to make reasonably-sized gif

data = air.isel(lat=10, time=slice(None,None,40))

Create animated plot

anim = data.plot(animate_over='time') anim.save('line1.gif', writer='imagemagick') plt.show() ``` now produces this gif: ~~The units on the timeline are formatted incorrectly because this PR isn't merged yet~~

I think it looks pretty good! It even animates the title properly. The actual animation creation only takes one line to do.

This currently only works for a plot with a single line, which is animated over a coordinate dimension. ~~It also required some minor modifications/bugfixes to animatplot, so it probably isn't reproducible right out of the box yet.~~ If you want to try this out then use the develop branch of my forked version of animatplot.

The reason I've put this up is because I wanted to

  1. show people the level of complexity required, and
  2. get people's opinion on the implementation.

I feel like although it required only ~100 lines extra to do this then the logic is very fragmented and scattered through the plot.line and plot._infer_line_data functions. In 2D this would get even more complicated, but I can't see a good way to abstract the case of animation out?

(@t-makaro I expect you will be interested in this)

EDIT: To-Do list:

  • [x] Animate single line
  • [x] Animated line and static line on same axes
  • [x] Animate multiple lines on same axes
  • [x] Multiple animated line plots on same figure
  • [ ] ~~FacetGrids of multiple animated lines~~ (will leave for a later PR)
  • [ ] Complete set of tests
  • [x] Add animatplot as optional dependency
  • [x] Add new CI tests using animatplot
  • [ ] New documentation page
  • [x] Fix issues with formatting of timeline label (fixed by https://github.com/t-makaro/animatplot/pull/46)
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2729/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull

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