Missing examples for the map and map_dataarray methods of FacetGrid objects
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Documentación
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- jupyter-notebook, matplotlib, numpy, pandas, python
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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()
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 204
- Forks
- 121
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de xarray-contrib/xarray-tutorial
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
help wanted
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
xarray-contrib/xarray-tutorial#362 · 2 comentarios · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Todos los issues de xarray-contrib/xarray-tutorial
Issues similares
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BasedHardware/omi#15320 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
bancolombia/sentinel#23 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
AOSSIE-Org/OrgExplorer#245 ·
-
tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
gordonwatts/test-wsl2-llm#151 ·