posit-dev / posit-dev/positron

plt.show() function in on different data sets trigger overlaying plots, if plt.figure() is absent

Open
#7,591 3 comments 0 reactions 1 assignee View on GitHub

@isabelizimm is already working on this.

Since Mar 11, 2026.

area: plots lang: python
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

System details:

Positron and OS details:

Positron Version: 2025.04.0 (Universal) build 250
Code - OSS Version: 1.98.0
Commit: 627b3d723ee0b3a5bd86731a75902d419cafe22d
Date: 2025-04-03T16:31:38.728Z
Electron: 34.2.0
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Darwin arm64 24.4.0

Interpreter details:

Python 3.13.0

Describe the issue:

Running a script that generates a plot overlays it on top of a pre-existing plot from unrelated script, if user does NOT call out plt.figure().

Steps to reproduce the issue:

  1. Run the following script or any other script that makes a plot based on a data file. Please note that I commented plt.figure() on purpose, to show that the absence of that line triggers the undesired behavior.
import matplotlib.pyplot as plt

# plt.figure(figsize=(8, 5))
plt.plot([1, 2, 3], [4, 5, 6])
plt.title("Sample Plot")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")

plt.show()
  1. Run another script that makes another plot. Notice that this second plot will be overlayed on top of the first one, despite differences in the data.
import matplotlib.pyplot as plt

# plt.figure(figsize=(8, 5))
plt.plot([1, 2, 4], [4, 8, 16])
plt.title("Sample Plot")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")

plt.show()
  1. This is just an example to make it clear and concise. In addition. if script 1 happened to be generating a plot from a CSV file, for instance, and script 2 was the same as above, overlaying of assets would still take place, despite origin file and data being completely different.

Expected or desired behavior:

Behavior similar to VS code or Jupyter Notebooks OR some warning dialogue asking the user if they would like to overlay plots, or create independent ones. This issue warrants discussion though, because should we treat that as user error for not adding plt.figure()? Or should we be overly gracious with different practices and expected VS code-like behavior, even if they are not necessarily rooted in documentation?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.