schloerke commited on
Commit
e85cac3
1 Parent(s): 8b4dab4

Remove shiny.experimental using shiny v0.6.0

Browse files
Files changed (1) hide show
  1. app.py +11 -15
app.py CHANGED
@@ -6,7 +6,6 @@ import pandas as pd
6
  import seaborn as sns
7
  import shinyswatch
8
 
9
- import shiny.experimental as x
10
  from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
11
 
12
  sns.set_theme()
@@ -18,10 +17,10 @@ numeric_cols: List[str] = df.select_dtypes(include=["float64"]).columns.tolist()
18
  species: List[str] = df["Species"].unique().tolist()
19
  species.sort()
20
 
21
- app_ui = x.ui.page_fillable(
22
  shinyswatch.theme.minty(),
23
  ui.layout_sidebar(
24
- ui.panel_sidebar(
25
  # Artwork by @allison_horst
26
  ui.input_selectize(
27
  "xvar",
@@ -41,16 +40,13 @@ app_ui = x.ui.page_fillable(
41
  ui.hr(),
42
  ui.input_switch("by_species", "Show species", value=True),
43
  ui.input_switch("show_margins", "Show marginal plots", value=True),
44
- width=2,
45
  ),
46
- ui.panel_main(
47
- ui.output_ui("value_boxes"),
48
- x.ui.output_plot("scatter", fill=True),
49
- ui.help_text(
50
- "Artwork by ",
51
- ui.a("@allison_horst", href="https://twitter.com/allison_horst"),
52
- class_="text-end",
53
- ),
54
  ),
55
  ),
56
  )
@@ -91,11 +87,11 @@ def server(input: Inputs, output: Outputs, session: Session):
91
  df = filtered_df()
92
 
93
  def penguin_value_box(title: str, count: int, bgcol: str, showcase_img: str):
94
- return x.ui.value_box(
95
  title,
96
  count,
97
  {"class_": "pt-1 pb-0"},
98
- showcase=x.ui.as_fill_item(
99
  ui.tags.img(
100
  {"style": "object-fit:contain;"},
101
  src=showcase_img,
@@ -127,7 +123,7 @@ def server(input: Inputs, output: Outputs, session: Session):
127
  if name in input.species()
128
  ]
129
 
130
- return x.ui.layout_column_wrap(1 / len(value_boxes), *value_boxes)
131
 
132
 
133
  # "darkorange", "purple", "cyan4"
 
6
  import seaborn as sns
7
  import shinyswatch
8
 
 
9
  from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
10
 
11
  sns.set_theme()
 
17
  species: List[str] = df["Species"].unique().tolist()
18
  species.sort()
19
 
20
+ app_ui = ui.page_fillable(
21
  shinyswatch.theme.minty(),
22
  ui.layout_sidebar(
23
+ ui.sidebar(
24
  # Artwork by @allison_horst
25
  ui.input_selectize(
26
  "xvar",
 
40
  ui.hr(),
41
  ui.input_switch("by_species", "Show species", value=True),
42
  ui.input_switch("show_margins", "Show marginal plots", value=True),
 
43
  ),
44
+ ui.output_ui("value_boxes"),
45
+ ui.output_plot("scatter", fill=True),
46
+ ui.help_text(
47
+ "Artwork by ",
48
+ ui.a("@allison_horst", href="https://twitter.com/allison_horst"),
49
+ class_="text-end",
 
 
50
  ),
51
  ),
52
  )
 
87
  df = filtered_df()
88
 
89
  def penguin_value_box(title: str, count: int, bgcol: str, showcase_img: str):
90
+ return ui.value_box(
91
  title,
92
  count,
93
  {"class_": "pt-1 pb-0"},
94
+ showcase=ui.fill.as_fill_item(
95
  ui.tags.img(
96
  {"style": "object-fit:contain;"},
97
  src=showcase_img,
 
123
  if name in input.species()
124
  ]
125
 
126
+ return ui.layout_column_wrap(*value_boxes, width = 1 / len(value_boxes))
127
 
128
 
129
  # "darkorange", "purple", "cyan4"