marimo
marimo copied to clipboard
Duplicated boxplots
Describe the bug
The same boxplot is output 7 times. Other matplotlib plot types seem to work correctly.
Will you submit a PR?
- [ ] Yes
Environment
{
"marimo": "0.16.5",
"editable": false,
"location": ".../python3.13/site-packages/marimo",
"OS": "Darwin",
"OS Version": "24.6.0",
"Processor": "arm",
"Python Version": "3.13.7",
"Locale": "en_US",
"Binaries": {
"Browser": "141.0.7390.108",
"Node": "--"
},
"Dependencies": {
"click": "8.3.0",
"docutils": "0.22.2",
"itsdangerous": "2.2.0",
"jedi": "0.19.2",
"markdown": "3.9",
"narwhals": "2.7.0",
"packaging": "25.0",
"psutil": "7.1.0",
"pygments": "2.19.2",
"pymdown-extensions": "10.16.1",
"pyyaml": "6.0.3",
"starlette": "0.48.0",
"tomlkit": "0.13.3",
"typing-extensions": "4.15.0",
"uvicorn": "0.35.0",
"websockets": "15.0.1"
},
"Optional Dependencies": {
"loro": "1.8.1",
"python-lsp-ruff": "2.3.0",
"python-lsp-server": "1.13.1",
"ruff": "0.14.0"
},
"Experimental Flags": {}
}
Code to reproduce
import marimo as mo
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.boxplot([0])
Thanks for filing.
For a workaround, make ax the output of the cell:
import marimo as mo
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.boxplot([0])
ax
Additional context. Some matplotlib plot functions, like hist and boxplot, return data structures with many plot-like objects. I don't know why matplotlib is designed this way, but that's why you're seeing the repeated plots:
This sounds great -- thank you for the workaround!