Colormap not preserved in scatter plot when generating baseline plot.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- matplotlib, python
- Lĩnh vực
- data-visualization, testing-qa
Hướng nghiên cứu
Bắt đầu với ví dụ test_time_height_scatter được hiển thị và routine time_height_scatter, sau đó so sánh hình được hiển thị trực tiếp với baseline được tạo thông qua pytest-mpl. Truy vết cách biểu đồ phân tán và colormap của nó được ghi lại trong quá trình tạo baseline; hoàn tất khi baseline được tạo bảo toàn colormap được hiển thị bởi hình trực tiếp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello, when we are trying to create a baseline for a unit test that uses a scatter plot, we have noticed that pytest-mpl has not been preserving the colormap used in our scatter plot.
For example, the plot we wish to compare against is this:

When we run the unittest through simply doing an import and showing the resulting figure we get the figure above. However, whenever we use pytest to generate the baseline figure, we get the below figure:

Main test:
@pytest.mark.mpl_image_compare(tolerance=30)
def test_time_height_scatter():
sonde_ds = arm.read_netcdf(
sample_files.EXAMPLE_SONDE1)
display = TimeSeriesDisplay({'sgpsondewnpnC1.b1': sonde_ds},
figsize=(7, 3))
display.time_height_scatter('tdry', day_night_background=True)
sonde_ds.close()
return display.fig
time_height_scatter routine:
def time_height_scatter(
self, data_field=None, dsname=None, cmap='rainbow',
alt_label=None, alt_field='alt', cb_label=None, **kwargs):
"""
Create a time series plot of altitued and data varible with
color also indicating value with a color bar. The Color bar is
positioned to serve both as the indicator of the color intensity
and the second y-axis.
Parameters
----------
data_field: str
Name of data field in the object to plot on second y-axis
height_field: str
Name of height field in the object to plot on first y-axis.
dsname: str or None
The name of the datastream to plot
cmap: str
Colorbar corlor map to use.
alt_label: str
Altitued first y-axis label to use. If not set will try to use
long_name and units.
alt_field: str
Label for field in the object to plot on first y-axis.
cb_label: str
Colorbar label to use. If not set will try to use
long_name and units.
**kwargs: keyword arguments
Any other keyword arguments that will be passed
into TimeSeriesDisplay.plot module when the figure
is made.
"""
if dsname is None and len(self._arm.keys()) > 1:
raise ValueError(("You must choose a datastream when there are 2 "
"or more datasets in the TimeSeriesDisplay "
"object."))
elif dsname is None:
dsname = list(self._arm.keys())[0]
# Get data and dimensions
data = self._arm[dsname][data_field]
altitude = self._arm[dsname][alt_field]
dim = list(self._arm[dsname][data_field].dims)
xdata = self._arm[dsname][dim[0]]
if alt_label is None:
try:
alt_label = (altitude.attrs['long_name'] +
''.join([' (', altitude.attrs['units'], ')']))
except KeyError:
alt_label = alt_field
if cb_label is None:
try:
cb_label = (data.attrs['long_name'] +
''.join([' (', data.attrs['units'], ')']))
except KeyError:
cb_label = data_field
colorbar_map = plt.cm.get_cmap(cmap)
self.fig.subplots_adjust(left=0.1, right=0.86,
bottom=0.16, top=0.91)
ax1 = self.plot(alt_field, color='black', **kwargs)
ax1.set_ylabel(alt_label)
ax2 = ax1.twinx()
sc = ax2.scatter(xdata.values, data.values, c=data.values,
marker='.', cmap=colorbar_map)
cbaxes = self.fig.add_axes(
[self.fig.subplotpars.right + 0.02, self.fig.subplotpars.bottom,
0.02, self.fig.subplotpars.top - self.fig.subplotpars.bottom])
cbar = plt.colorbar(sc, cax=cbaxes)
ax2.set_ylim(cbar.get_clim())
cbar.ax.set_ylabel(cb_label)
ax2.set_yticklabels([])
return self.axes[0]
Any help you could provide on this would be appreciated.
- Ngôn ngữ chính
- Python
- Star
- 274
- Fork
- 53
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của matplotlib/pytest-mpl
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
matplotlib/pytest-mpl#264 · 2 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
matplotlib/pytest-mpl#263 · 3 bình luận ·
-
Old docs on matplotlib.orgĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
matplotlib/pytest-mpl#262 · 6 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
matplotlib/pytest-mpl#261 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
matplotlib/pytest-mpl#257 · 2 bình luận ·
Tất cả issue của matplotlib/pytest-mpl
Issue tương tự
-
[Doc]: Feedback for `/zh-cn/v0.30.0/tutorials/models/Qwen3.6-35B-A3B.html`A3社区配置和基线不一致,社区配置也达不到基线Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
vllm-project/vllm-ascend#24429 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
simnJS/AnyPS5#735 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sqlreview.sh: `remap` with no review draft seeds one, and `delta` prints the diff then exits 2Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
nq-rdl/agent-extensions#623 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
vortex-data/vortex#12633 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gke-labs/kube-agents#7955 ·
Maintainer thường phản hồi trong vòng 1 ngày