Spaces:
Runtime error
Runtime error
gordon-posit
commited on
Commit
•
2757798
1
Parent(s):
b8b7cbb
Mobile friendly modificatons
Browse files
app.py
CHANGED
@@ -23,9 +23,6 @@ app_ui = x.ui.page_fillable(
|
|
23 |
x.ui.layout_sidebar(
|
24 |
x.ui.sidebar(
|
25 |
# Artwork by @allison_horst
|
26 |
-
ui.tags.img(
|
27 |
-
src="palmerpenguins.png", width="80%", class_="mt-0 mb-2 mx-auto"
|
28 |
-
),
|
29 |
ui.input_selectize(
|
30 |
"xvar",
|
31 |
"X variable",
|
@@ -46,8 +43,7 @@ app_ui = x.ui.page_fillable(
|
|
46 |
ui.input_switch("show_margins", "Show marginal plots", value=True),
|
47 |
),
|
48 |
ui.output_ui("value_boxes"),
|
49 |
-
|
50 |
-
x.ui.output_plot("scatter", fill=True, brush=ui.brush_opts()),
|
51 |
fill=True,
|
52 |
fillable=True,
|
53 |
),
|
@@ -62,21 +58,9 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
62 |
# This calculation "req"uires that at least one species is selected
|
63 |
req(len(input.species()) > 0)
|
64 |
|
65 |
-
if False:
|
66 |
-
if "scatter_brush" in input:
|
67 |
-
info = input.scatter_brush()
|
68 |
-
print(str(info))
|
69 |
-
else:
|
70 |
-
print("No brush!")
|
71 |
-
|
72 |
# Filter the rows so we only include the desired species
|
73 |
return df[df["Species"].isin(input.species())]
|
74 |
|
75 |
-
@output
|
76 |
-
@render.text
|
77 |
-
def brush():
|
78 |
-
return str(input.scatter_brush())
|
79 |
-
|
80 |
@output
|
81 |
@render.plot
|
82 |
def scatter():
|
@@ -102,18 +86,9 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
102 |
|
103 |
def penguin_value_box(title: str, count: int, bgcol: str, showcase_img: str):
|
104 |
return x.ui.value_box(
|
105 |
-
|
106 |
count,
|
107 |
{"class_": "pt-1 pb-0"},
|
108 |
-
# ui.h1(HTML("$1 <i>Billion</i> Dollars")),
|
109 |
-
# ui.span(
|
110 |
-
# # bsicons::bs_icon("arrow-up"),
|
111 |
-
# # "X",
|
112 |
-
# " 30% VS PREVIOUS 30 DAYS",
|
113 |
-
# ),
|
114 |
-
# showcase = bsicons::bs_icon("piggy-bank"),
|
115 |
-
# showcase=f"{name}!",
|
116 |
-
# class_="bg-success",
|
117 |
showcase=x.ui.bind_fill_role(
|
118 |
ui.tags.img(
|
119 |
{"style": "object-fit:contain;"},
|
|
|
23 |
x.ui.layout_sidebar(
|
24 |
x.ui.sidebar(
|
25 |
# Artwork by @allison_horst
|
|
|
|
|
|
|
26 |
ui.input_selectize(
|
27 |
"xvar",
|
28 |
"X variable",
|
|
|
43 |
ui.input_switch("show_margins", "Show marginal plots", value=True),
|
44 |
),
|
45 |
ui.output_ui("value_boxes"),
|
46 |
+
x.ui.output_plot("scatter", fill=True),
|
|
|
47 |
fill=True,
|
48 |
fillable=True,
|
49 |
),
|
|
|
58 |
# This calculation "req"uires that at least one species is selected
|
59 |
req(len(input.species()) > 0)
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
# Filter the rows so we only include the desired species
|
62 |
return df[df["Species"].isin(input.species())]
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
@output
|
65 |
@render.plot
|
66 |
def scatter():
|
|
|
86 |
|
87 |
def penguin_value_box(title: str, count: int, bgcol: str, showcase_img: str):
|
88 |
return x.ui.value_box(
|
89 |
+
title,
|
90 |
count,
|
91 |
{"class_": "pt-1 pb-0"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
showcase=x.ui.bind_fill_role(
|
93 |
ui.tags.img(
|
94 |
{"style": "object-fit:contain;"},
|
colors.py
CHANGED
@@ -15,7 +15,6 @@ palette: Dict[str, Tuple[float, float, float]] = {
|
|
15 |
}
|
16 |
|
17 |
bg_palette = {}
|
18 |
-
# bgcols: list[str] = sns.color_palette().as_hex()
|
19 |
# Use `sns.set_style("whitegrid")` to help find approx alpha value
|
20 |
for name, col in palette.items():
|
21 |
# Adjusted n_colors until `axe` accessibility did not complain about color contrast
|
|
|
15 |
}
|
16 |
|
17 |
bg_palette = {}
|
|
|
18 |
# Use `sns.set_style("whitegrid")` to help find approx alpha value
|
19 |
for name, col in palette.items():
|
20 |
# Adjusted n_colors until `axe` accessibility did not complain about color contrast
|