Skip to content

Instantly share code, notes, and snippets.

@cpsievert
cpsievert / README.md
Last active September 17, 2024 22:18
Minimal reprex for shinywidgets on shinyapps.io issue

This gist contains a minimal reprex for this CS ticket

The app.py was deployed here. If you visit there, and repeatedly refresh, you should (eventually) see this error:

Screenshot 2024-09-17 at 3 20 15 PM

Note that the reprex needs this branch of shinywidgets, which switches the order of the libembed-amd.js and output.js scripts in the head of the document.

For some reason, quarto serve seems to be ordering these `

@cpsievert
cpsievert / app.py
Created July 15, 2024 15:07
Filter DataGrid using plotly scatterplot
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from shinywidgets import render_plotly
from shiny import reactive
from shiny.express import render
num_rows = 10
x_points = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
@cpsievert
cpsievert / app.py
Created May 21, 2024 15:14
Access click on plotly choroplethmapbox
# Example adapted from https://plotly.com/python/mapbox-county-choropleth/
import json
from urllib.request import urlopen
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from shinywidgets import render_plotly
@cpsievert
cpsievert / 01-tooltips-popovers.R
Created August 10, 2023 15:55
Code examples for bslib 0.5.1 announcement blog post
# ------------------------------------------------------------------------
# Learn more about bslib::tooltip() and bslib::popover() at
# https://rstudio.github.io/bslib/articles/tooltips-popovers/index.html
# ------------------------------------------------------------------------
library(shiny)
library(bslib)
library(palmerpenguins)
library(ggplot2)
library(bslib)
library(htmltools)
library(crosstalk)
library(plotly)
library(leaflet)
# Create Diamonds view
dat <- SharedData$new(dplyr::sample_n(diamonds, 1000))
sidebar_diamonds <- layout_sidebar(
library(bslib)
library(bsicons)
library(crosstalk)
library(plotly)
dat <- SharedData$new(dplyr::sample_n(diamonds, 1000))
accordion_filters <- accordion(
accordion_panel(
"Dropdowns", icon = bs_icon("menu-app"),
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.