home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 200364693

This data as json

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
200364693 MDU6SXNzdWUyMDAzNjQ2OTM= 1201 pass projection argument to plt.subplot when faceting with cartopy transform 731499 closed 0     10 2017-01-12T13:18:52Z 2020-03-29T16:30:29Z 2020-03-29T16:30:29Z CONTRIBUTOR      

I have a data 3D DataArray with Time, Latitude and Longitude coordinates.

I want to plot maps of this dataset, faceted by Time. The following code

import cartopy.crs as ccrs proj = ccrs.PlateCarree() data.plot(transform=proj, col='Time', col_wrap=3, robust=True)

fails with

ValueError: Axes should be an instance of GeoAxes, got <class 'matplotlib.axes._subplots.AxesSubplot'>

this is because to plot with a transform, the axes must be a GeoAxes, which is done with something like plt.subplot(111, projection=proj). The implicit subplotting done when faceting does not do that. To make the faceting works, I had to do

import cartopy.crs as ccrs proj = ccrs.PlateCarree() data.plot(transform=proj, col='Time', col_wrap=3, robust=True, subplot_kws={'projection':proj})

I propose that, when plot faceting is requested with a transform kw, the content of that keyword should be passed to the subplot function as a projection argument automatically by default. If a projection is provided explicitely like in the call above, use that one.

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

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 10 rows from issue in issue_comments
Powered by Datasette · Queries took 0.562ms · About: xarray-datasette