Missing examples for the map and map_dataarray methods of FacetGrid objects
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- jupyter-notebook, matplotlib, numpy, pandas, python
调研方向
The issue names no target file; start by locating the official FacetGrid documentation and existing examples for map and map_dataarray. Adapt the proposed air-temperature example to show both methods, and consider how the boolean overlay is represented. Done means newcomers can follow documented examples for adding hatching or stippling to faceted plots.
由索引模型根据 Issue 内容生成。
描述
Faceted plots are a great feature of xarray, in my view, sometimes presented as a 'quick and dirty' way to plot data, while it could be instead the best way to produce high quality subplot panels without any tedious loop on matplotlib axes.
I have been struggling to understand how map and map_dataarray methods work to overlay, e.g. hatching or stippling to 2D faceted plots derived from xr.plot.pcolormesh or xr.plot.imshow . This is very useful to highlight values labelled as True after passing a statistical test for example.
I found a way to go with the map_dataarray method (Note that I have never succeeded in using the map method for datasets. I do not understand how it works).
Below, I propose an example based on the official documentation. Feel free to use it or adapt it to improve the Xarray documentation:
import numpy as np;
import pandas as pd;
import matplotlib.pyplot as plt;
import xarray as xr
airtemps = xr.tutorial.open_dataset("air_temperature")
air = airtemps.air - 273.15
t = air.isel(time=slice(0, 365 * 4, 250))
warm = t>15 #Suppose we want to hatch regions with temperature warmer than 15°C. Quite a dumb idea but this is just to illustrate
test = xr.concat([t,warm],dim='dummy')
g_simple = test.isel(dummy=0).plot(x="lon", y="lat", col="time", col_wrap=3)
g_simple.data = test.isel(dummy=1) #Here I just replace the temperature data of the FacetGrid object with the boolean data
g_simple.map_dataarray(xr.plot.contourf,x='lon',y='lat', levels=3, hatches=[ '' , '////' ], alpha=0, add_colorbar=False)
plt.show()
- 主要语言
- Jupyter Notebook
- 星标
- 204
- 派生
- 121
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
xarray-contrib/xarray-tutorial 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
help wanted
难度 4/5 3-5 天 新手友好度 48/100
xarray-contrib/xarray-tutorial#362 · 2 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 55/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 38/100
查看 xarray-contrib/xarray-tutorial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
pydata/pydata-sphinx-theme#2503 ·
-
bug triage_needed
难度 2/5 1-3 小时 新手友好度 75/100
-
P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
🦾 ai-candidate
难度 2/5 1-3 小时 新手友好度 88/100