Skip to content

plt.hist shows a list of BarContainers #2628

@dmadisetti

Description

@dmadisetti

Describe the bug

On

import matplotlib.pyplot as plt
import numpy as np


plt.hist(np.random.rand(1000), bins=100)

marimo iterates over the bar container to produce many duplicate plots:

Image

Expected type nd.array, nd.array, barcontainer: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html

Outputting the bar container by itself works as expected:

Image

but wrapping it in an iterable produces bad news:

Image

Environment

head, see: https://marimo.app/l/uudxmj

Code to reproduce

import marimo

__generated_with = "0.9.10-dev8"
app = marimo.App()


@app.cell
def __():
    import matplotlib.pyplot as plt
    import numpy as np


    A, B, C = plt.hist(np.random.rand(1000), bins=100)
    return A, B, C, np, plt


@app.cell
def __(C):
    [C]
    return


@app.cell
def __(C):
    C
    return


if __name__ == "__main__":
    app.run()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions