plots: with interactive mode off, `plt.figure(1); plt.show()` selects another edited figure instead of figure 1
Maintainer thường phản hồi trong vòng 1 ngày
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
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- matplotlib, python, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Read extensions/positron-python/python_files/posit/positron/tests/test_matplotlib_backend/test_console.py and trace the pyplot_show flow in matplotlib_backend/console.py; the report also points to src/vs/workbench/contrib/positronPlots and languageRuntimePlotClient.ts. First reproduce the supplied sequence with interactive mode off. Add coverage for an update without a pre-render arriving with another plot's show, and confirm the shown figure remains selected after the update renders.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- Reproduced by a human: Confirmed using the provided steps.
Details
- Found by: exploratory test on
aus/matperflib - Positron: 2026.12.0 build 0 (
1b386c6a96) - OS: Ubuntu 24.04.5 LTS (Linux x86_64)
- Kallichore: 0.1.75
Describe the issue
A Python user who turns interactive mode off, edits one figure and then calls plt.figure(n); plt.show() sees the edited figure in the Plots pane instead of figure n. One click on the filmstrip fixes it, and it needs another figure changed in the same cell.
Steps to reproduce
- A Python 3.14 console with matplotlib 3.11.2 and the default Positron backend, with no open figures
three_figs.py(below) in the workspace, which makes figures 1, 2 and 3 and keepsax2
- Run
%run three_figs.pyin the Python console. - Run
plt.ioff()in the Python console. - Run
plt.figure(1); plt.show()in the Python console. - Verify the Plots pane shows
matplotlib 1→ PASS - Click Show Next Plot in the Plots pane toolbar.
- Click Show Next Plot in the Plots pane toolbar.
- Run
ax2.set_title("edited 1"); plt.figure(1); plt.show()in the Python console. - Verify the Plots pane shows
matplotlib 1→ FAIL
Observed
After ax2.set_title("edited 1"); plt.figure(1); plt.show(), the Plots pane selects matplotlib 2, the figure whose title changed, not figure 1. With interactive mode on, the same steps also select matplotlib 2.
Expected
The Plots pane selects matplotlib 1, the figure made active just before plt.show(), as it does when no other figure was edited and as the main build does with interactive mode off.
Error messages
<<< RECV comm_msg [iopub]: {"comm_id":"fb98bdb4-8fc5-4e3c-897a-5f32252195da","data":{"jsonrpc":"2.0","method":"update","params":{}}}
Logged in logs/37177-python-supervisor.log:10033 (Kernel supervisor), 1x 18:43:25.
<<< RECV comm_msg [iopub]: {"comm_id":"255bb982-f870-406d-9259-faaa007d3c8a","data":{"jsonrpc":"2.0","method":"update","params":{}}}
Logged in logs/37177-python-supervisor.log:9189 (Kernel supervisor), 1x 18:38:55.
Evidence
Screenshots and logs are in the exploratory test report for this run.
Likely cause (hypothesis, not verified)
The new pyplot_show in matplotlib_backend/console.py sends an update for the edited figure before the active figure's show, and the Plots pane selects an updated plot only after re-rendering it, so that select lands last. In the log, comm fb98bdb4 is figure 2 and c582a8f4 is figure 1 (the plot that plt.figure(1); plt.show() selected at 18:43:10). The show selects at once (positronPlotsService.ts around line 1351), but an update with no pre-render waits for await this.queuePlotUpdateRequest() in languageRuntimePlotClient.ts (around line 311) before it fires onDidRenderUpdate, which also selects. Both events carry empty params here, so no pre-render was sent. The draw_idle call for stale inactive figures was added by this change. With interactive mode off, main sent show events only and kept figure 1 selected. With interactive mode on, main's after-cell redraw sends the same late update, so that mode behaves the same on main.
Test gap (suggestion)
- When a plot client receives an
updatewithout a pre-render and another plot'sshowin the same batch, the plot that was shown stays selected after the update's render completes. → Unit test; place it per the repo's test guidance
Other tests that touch this code: extensions/positron-python/python_files/posit/positron/tests/test_matplotlib_backend/test_console.py (Unit), src/vs/workbench/contrib/positronPlots/test/browser/plotGalleryRemoval.vitest.tsx (Unit)
three_figs.py
import matplotlib.pyplot as plt
fig1, ax1 = plt.subplots(num=1)
ax1.plot([1, 2, 3], [3, 1, 2], "r-")
fig2, ax2 = plt.subplots(num=2)
ax2.plot([1, 2, 3], [1, 2, 3], "b-")
fig3, ax3 = plt.subplots(num=3)
ax3.plot([1, 2, 3], [2, 2, 2], "g-")
- Ngôn ngữ chính
- TypeScript
- Star
- 4.4k
- Fork
- 207
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 341
Chuẩn bị môi trường
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.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 posit-dev/positron
-
Memory meter counts page cache as used memory under a cgroup limitCó thể đã có người làm @jmcphers đã nhận 1 ngày trước. Đang mởarea: workbench bug memory-use support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
posit-dev/positron#17414 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: plots bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: remote host bug support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
posit-dev/positron#17249 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: assistant
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
DuckDB ggsql connection ignores read-only, fails with a lock error when the file is open in Data ConnectionsCó thể đã có người làm @samclark2015 đã nhận 16 ngày trước. Đang mởarea: connections area: duckdb area: ggsql bug support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
posit-dev/positron#17108 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của posit-dev/positron
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
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
posit-dev/positron-sas-extension#196 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug composer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
inmanta/web-console#8037 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: AlFajer Palestine FHDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: v5 dist/types/components.d.ts imports @stencil/core/runtime instead of ./stencil-public-runtimeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày