xarray removes axis grid from pcolormesh
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- matplotlib, python
调研方向
报告指出,提交 7ff2b04a9bfa5da86d23a0615dbb3ae6a84bde91 引入了一项回归,但没有提及文件或测试。先阅读该提交,并追踪 xarray DataArray 对 pcolormesh 的绘图路径。将复现的输出与 axes.grid=True 时的 plt.pcolormesh 进行比较;当 xarray 绘图遵循网格设置(包括次网格)时,即为完成。
由索引模型根据 Issue 内容生成。
描述
What happened?
Introduced with
https://github.com/pydata/xarray/commit/7ff2b04a9bfa5da86d23a0615dbb3ae6a84bde91
for whatever reason.
It is inconsistent with matplotlib and makes styles that explicitly set a grid unusable. In addition, it only switches off the major grid, leaving the minor grid visible which makes the figures look even worse. I suggest to revert this commit.
What did you expect to happen?
The grid should be visible as set by the style or with rcParams.
Minimal Complete Verifiable Example
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "xarray[complete]@git+https://github.com/pydata/xarray.git@main",
# ]
# ///
#
# This script automatically imports the development branch of xarray to check for issues.
# Please delete this header if you have _not_ tested this script with `uv run`!
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
xr.show_versions()
# your reproducer code ...
x = np.random.random((3, 5))
plt.rcParams["axes.grid"] = True
# compare
plt.pcolormesh(x) # grid shown as expected
# vs
xr.DataArray(x).plot() # no grid
Steps to reproduce
No response
MVCE confirmation
- Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
- Complete example — the example is self-contained, including all data and the text of any traceback.
- Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
- New issue — a search of GitHub Issues suggests this is not a duplicate.
- Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: None
python: 3.13.16 | packaged by conda-forge | (main, Oct 13 2026, 16:57:20) [GCC 15.3.0]
python-bits: 64
OS: Linux
OS-release: 6.12.115+deb13.1-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: ('C', 'UTF-8')
libhdf5: 2.1.0
libnetcdf: 4.10.1
xarray: 2026.7.0
pandas: 3.0.6
numpy: 2.5.4
scipy: 1.18.1
netCDF4: 1.7.4
pydap: None
h5netcdf: 1.8.1
h5py: 3.16.0
zarr: 3.4.1
cftime: 1.6.5
nc_time_axis: 1.4.1
iris: None
bottleneck: 1.6.0
dask: 2026.8.0
distributed: 2026.8.0
matplotlib: 3.11.2
cartopy: 0.26.0
seaborn: None
numbagg: None
fsspec: 2026.9.0
cupy: None
pint: None
sparse: None
flox: 9.11
numpy_groupies: 0.14.2
setuptools: 84.0.0
pip: 26.2.2
conda: 26.9.3
pytest: 9.1.1
mypy: None
IPython: 9.17.1
sphinx: 9.1.1
- 主要语言
- Python
- 星标
- 4.2k
- 派生
- 1.5k
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 74
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pydata/xarray 的其他 Issue
-
`DataTree.map_over_datasets` behavior can be obscure sometimes可能已有人在做 @mohansree14 于 24 天前认领。 未关闭needs triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Comparing attrs that contain a dict of NumPy arrays raises ValueError in identical / assert_identical可能已有人在做 @SohamXYZDev 于 29 天前认领。 未关闭bug needs triage
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
RangeIndex` with datetime64 bounds cannot be printed (`Unknown format code 'g'`)可能已有人在做 @d-chambers 于 60 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
DataTree constructor error message says dict even though dict is not accepted可能已有人在做 @aryansk 于 100 天前认领。 未关闭bug contrib-good-first-issue topic-DataTree topic-error reporting
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
needs triage
难度 1/5 1 小时以内 新手友好度 65/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
abetlen/llama-cpp-python#2424 ·
维护者通常 1 天内回复
-
Bug IronPython Python 3
难度 2/5 1-3 小时 新手友好度 72/100
pyrevitlabs/pyRevit#4184 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 74/100
jqueryscript/awesome-claude-code#1009 ·
-
tests
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复