shiny.ui.output_plot(id, width='100%', height='400px', inline=False)#

Create a output container for a static plot.

Place a plot() result in the user interface. See plot() for more details on what types of plots are supported.

  • id (str) – An input id.

  • width (str) – The CSS width, e.g. ‘400px’, or ‘100%’

  • height (str) – The CSS height, e.g. ‘100%’ or ‘600px’

  • inline (bool) – If True, the result is displayed inline

Return type

A UI element

See also

plot, output_image


#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
from shiny import *
import numpy as np
import matplotlib.pyplot as plt

app_ui = ui.page_fluid(
        "n", "input_slider()", min=10, max=100, value=50, step=5, animate=True

def server(input: Inputs, output: Outputs, session: Session):
    def p():
        x_rand = 100 + 15 * np.random.randn(437)
        fig, ax = plt.subplots()
        ax.hist(x_rand, int(input.n()), density=True)
        return fig

app = App(app_ui, server)