Skip to content

Instantly share code, notes, and snippets.

@Ray901
Last active March 24, 2025 08:02
Show Gist options
  • Select an option

  • Save Ray901/149ad5aad12acb605d4eca862eb6b53b to your computer and use it in GitHub Desktop.

Select an option

Save Ray901/149ad5aad12acb605d4eca862eb6b53b to your computer and use it in GitHub Desktop.
from shiny.express import input, render, ui
ui.input_selectize(
"var", "Select variable",
choices=["bill_length_mm", "body_mass_g"]
)
@render.plot
def hist():
from matplotlib import pyplot as plt
from palmerpenguins import load_penguins
df = load_penguins()
df[input.var()].hist(grid=False)
plt.xlabel(input.var())
plt.ylabel("count")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment