Plotting in a loop
marcus1487 opened this issue · comments
Documentation is
- Missing
- Outdated
- Confusing
- Not sure?
Explain in Detail
I want to create a set of plots for an unknown number of items. The obvious way to do this would be in a loop, but the documentation only provides the option for showing a plot by making the plot the last line of a notebook. This is not feasible (that I am aware) for an unknown number of plots. Is there a good workaround for this? It would be nice to have this in the docs if there is a good workaround as this is quite a common access pattern for me.
Your Suggestion for Changes
Add docs for workaround to plot variable number of plots from a single cell.
what library are you using for plotting? some come with built in ways to combine multiple, while for others, you can use marimo's layouting elements
https://docs.marimo.io/api/layouts/index.html
for Altair, you have
You could also use marimo layouting
charts = []
for d in data:
charts.append(create_chart(d))
mo.vstack(charts)
We also support tabs and accordions to put them in.
Unfortunately, i dont think this specific case belongs in the docs. This is a good discussion for our discord though - feel free to jump in (https://marimo.io/discord)
I am using plotnine, but exporting plots to matplotlib for the purposes of display in marimo. I will try the layout options. Layout options seem well suited to this task. I will give these a go and let you know if I have any issues. Thank you so much for the prompt response.
No problem!
Worked like a charm. Thank you again!