-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
241 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
/objects.json | ||
/_sidebar.yml | ||
/site_libs/ | ||
/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
project: | ||
type: default | ||
|
||
format: gfm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from shiny import App, Inputs, Outputs, Session, render, ui | ||
|
||
import shinyswatch | ||
|
||
app_ui = ui.page_fluid( | ||
ui.input_slider("num", "Number:", min=10, max=100, value=30), | ||
ui.output_text_verbatim("slider_val"), | ||
theme=shinyswatch.theme.darkly, # <- Use a shinyswatch theme here | ||
) | ||
|
||
|
||
def server(input: Inputs, output: Outputs, session: Session): | ||
@output | ||
@render.text | ||
def slider_val(): | ||
return f"{input.num()}" | ||
|
||
|
||
app = App(app_ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
shiny | ||
shinyswatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from shiny import App, render, req, ui | ||
|
||
# Try changing the theme from minty to united | ||
from shinyswatch.theme import minty as shiny_theme | ||
|
||
app_ui = ui.page_fluid( | ||
ui.input_slider("n", "N", min=0, max=100, value=20), | ||
ui.card(ui.output_plot("plot")), | ||
theme=shiny_theme, | ||
) | ||
|
||
|
||
def server(input): | ||
@render.plot(alt="A histogram") | ||
def plot(): | ||
np.random.seed(19680801) | ||
x = 100 + 15 * np.random.randn(437) | ||
|
||
fig, ax = plt.subplots() | ||
ax.hist(x, input.n(), density=True, color=shiny_theme.colors.primary) | ||
|
||
# Theme the plot to match the current theme | ||
fig.patch.set_facecolor("none") | ||
ax.set_facecolor("none") | ||
|
||
color_fg = shiny_theme.colors.body_color | ||
ax.tick_params(axis="both", colors=color_fg) | ||
ax.spines["bottom"].set_color(color_fg) | ||
ax.spines["top"].set_color(color_fg) | ||
ax.spines["left"].set_color(color_fg) | ||
ax.spines["right"].set_color(color_fg) | ||
|
||
return fig | ||
|
||
|
||
app = App(app_ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
numpy | ||
matplotlib | ||
shiny | ||
shinyswatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from shiny import App, Inputs, Outputs, Session, render, ui | ||
|
||
import shinyswatch | ||
|
||
app_ui = ui.page_fluid( | ||
shinyswatch.theme_picker_ui(), # <- Add the theme picker UI to your app | ||
ui.input_slider("num", "Number:", min=10, max=100, value=30), | ||
ui.output_text_verbatim("slider_val"), | ||
theme=shinyswatch.theme.zephyr, # <- Choose an initial theme (optional) | ||
) | ||
|
||
|
||
def server(input: Inputs, output: Outputs, session: Session): | ||
# Make sure your server function calls the theme picker server function | ||
shinyswatch.theme_picker_server() | ||
|
||
@output | ||
@render.text | ||
def slider_val(): | ||
return f"{input.num()}" | ||
|
||
|
||
app = App(app_ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
shiny | ||
shinyswatch |
Oops, something went wrong.