home / github / pull_requests

Menu
  • Search all tables
  • GraphQL API

pull_requests: 249014177

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
249014177 MDExOlB1bGxSZXF1ZXN0MjQ5MDE0MTc3 2729 closed 0 [WIP] Feature: Animated 1D plots 35968931 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: ![line1](https://user-images.githubusercontent.com/35968931/56898342-b833a680-6a88-11e9-9529-ca8584943d0f.gif) ~~The units on the timeline are formatted incorrectly because [this PR](https://github.com/t-makaro/animatplot/pull/21) 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](https://github.com/TomNicholas/animatplot/tree/develop) 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) 2019-01-30T20:15:52Z 2021-06-24T08:46:31Z 2021-06-23T16:14:28Z   c07f76527018613ef00a7beb3a8ce906f33feb18     0 2e3b5059031c6f0577bc30d4ee9e2e877f69f0e3 3fb22cbf86e49be4a444fa062350bf7570abd6da MEMBER   13221727 https://github.com/pydata/xarray/pull/2729  

Links from other tables

  • 0 rows from pull_requests_id in labels_pull_requests
Powered by Datasette · Queries took 0.671ms