0

I am following the Shiny for Python tutorial, and it looks like the default plot example is not working on my computer. I can see the slider, but not the plot when I launch the application.

Matplotlib plots work fine when I launch them outside of a Shiny application.

Any idea why my plot is not showing ? There are no errors in the console of course.

Matplotlib version : 3.6.1

Shiny version : 0.2.4

IDE : pycharm

from shiny import App, render, ui

# Import modules for plot rendering
import numpy as np
import matplotlib.pyplot as plt

app_ui = ui.page_fluid(
    ui.layout_sidebar(
        ui.panel_sidebar(
            ui.input_slider("n", "N", 0, 100, 20),
        ),
        ui.panel_main(
            ui.output_plot("plot"),
        ),
    ),
)


def server(input, output, session):
    @output
    @render.plot(alt="A histogram")
    def plot():
        np.random.seed(19680801)
        x = 100 + 15 * np.random.randn(437)
        plt.hist(x, input.n(), density=True)

app = App(app_ui, server, debug=True)
M--
  • 25,431
  • 8
  • 61
  • 93
gdevaux
  • 2,308
  • 2
  • 10
  • 19
  • So I uninstall and install again everything and it works. Not sure what version of which lib or python was the problem. – gdevaux Oct 19 '22 at 09:00

0 Answers0