posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.74k stars 82 forks source link

Extraneous blue busy/progress UI element after plotting (Python only?) #2837

Closed juliasilge closed 6 months ago

juliasilge commented 6 months ago

If you run Python file like this to create a plot:

import seaborn as sns
sns.set_theme()
penguins = sns.load_dataset("penguins")

sns.lmplot(
    data=penguins,
    x="bill_length_mm", y="bill_depth_mm", hue="species",
    height=5
).figure.show()

the plot shows up in the Plots pane, but there is a blue progress/busy UI component here that makes it look like it is trying to do something:

https://github.com/posit-dev/positron/assets/12505835/ab483987-34be-4db5-875a-9ce2ee70d7de

I only observe this for matplotlib, not for ggplot2 or base R plots.

seeM commented 6 months ago

Thank you for testing and reporting all of these Python plotting issues!

I noticed this too. I think what's happening is that we get to this point twice:

https://github.com/posit-dev/positron/blob/4967231c71a12a7626b97258e90a8a1095ea6135/src/vs/workbench/contrib/positronPlots/browser/components/dynamicPlotInstance.tsx#L109-L111

The first progressBar gets overwritten, but we never call done() on it so it never ends. We may want to add && !progressBar to the condition.

The fact that we only see this now means that the matplotlib backend is doing something strange compared with the other plotting implementations. So we may also want to figure out why we get two Rendering state changes before any Rendered or Closed ones, and fix that too.

juliasilge commented 6 months ago

In Positron 2024.05.0 (Universal) build 1151, we no longer have this extra blue busy/progress UI element while plotting:

https://github.com/posit-dev/positron/assets/12505835/86b2ef3d-fe29-489e-8992-eab6d93ca955