xarray removes axis grid from pcolormesh

Đang mở Phù hợp với người mới
#11,919 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Sealdot đang làm issue này rồi.

Từ ngày 20/11/2026.

  • #11922 của @Sealdot — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
matplotlib, python
Lĩnh vực
data-visualization

Hướng nghiên cứu

Báo cáo xác định một lỗi hồi quy do commit 7ff2b04a9bfa5da86d23a0615dbb3ae6a84bde91 gây ra nhưng không nêu tệp hoặc bài kiểm thử nào. Hãy bắt đầu bằng cách đọc commit đó và lần theo đường đi của thao tác vẽ xarray DataArray cho pcolormesh. So sánh đầu ra tái hiện được với plt.pcolormesh khi axes.grid=True; hoàn tất khi thao tác vẽ của xarray tuân theo thiết lập lưới, bao gồm cả lưới phụ.

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

Mô tả

bug needs triage
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

Ngôn ngữ chính
Python
Star
4.2k
Fork
1.5k
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
74

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 pydata/xarray

Tất cả issue của pydata/xarray

Issue tương tự

Thêm issue về Python

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.