home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1785599886

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
1785599886 I_kwDOAMm_X85qbheO 7957 `FacetGrid` plot overlaying multiple variables from same dataset? 12760310 open 0     1 2023-07-03T08:15:42Z 2024-01-01T13:50:52Z   NONE      

What is your issue?

I'm trying to produce a facet plot which contains maps with different overlaid layers (e.g. a pcolormesh and streamplot). At the moment I'm creating the plot and then iterating over the axes to add the plots manuallay

```python p = dss['LH'].plot.pcolormesh( x='lon', y='lat', col="exp", )

for i, ax in enumerate(p.axes.flat): ax.coastlines() ax.streamplot( dss.isel(exp=i).lon.values, dss.isel(exp=i).lat.values, dss.isel(exp=i)['u_10m_gr'].values, dss.isel(exp=i)['v_10m_gr'].values, ) ```

This is far from optimal and doesn't really look clean to me. Also, I'm not entirely sure the order of p.axes.flat correspond to the one of the exp dimension I'm using to facet.

All examples in the doc (https://docs.xarray.dev/en/stable/user-guide/plotting.html) refer to the plot method of DataArray, so it seems that, once created the p object, no other variable from the dataset can be accessed.

However, on the doc it is mentioned

TODO: add an example of using the map method to plot dataset variables (e.g., with plt.quiver).

It is not clear to me whether the xarray.plot.FacetGrid.map method can indeed be used to plot another dataset variable or not. If that's not the case, is there any way to achieve what I'm doing without manually looping through the axes?

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

Links from other tables

  • 1 row from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.783ms · About: xarray-datasette