Missing examples for the map and map_dataarray methods of FacetGrid objects

Đang mở
#231 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
jupyter-notebook, matplotlib, numpy, pandas, python

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement visualization

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()

Figure_1

Ngôn ngữ chính
Jupyter Notebook
Star
204
Fork
121
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của xarray-contrib/xarray-tutorial

Tất cả issue của xarray-contrib/xarray-tutorial

Issue tương tự

Thêm issue về Data Visualization

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.