Skip to content

Instantly share code, notes, and snippets.

View AnnMarieW's full-sized avatar

Ann Marie Ward AnnMarieW

View GitHub Profile
@AnnMarieW
AnnMarieW / figure_friday_2024_week_52.py
Last active March 3, 2025 22:26
Plotly's Figure Friday Challenge 20024 Week 52: Public SaaS Company explorer
# Plotly's Figure Friday challenge. See more info here: https://community.plotly.com/t/figure-friday-2024-week-52/89593
import pandas as pd
from dash import Dash, dcc, Input, Output, State, callback, _dash_renderer, ctx
import dash_mantine_components as dmc
import dash_ag_grid as dag
import plotly.express as px
_dash_renderer._set_react_version("18.2.0")
dmc.add_figure_templates(default="mantine_dark")
@AnnMarieW
AnnMarieW / app.py
Created November 20, 2024 21:51
FastAPI with Dash
from fastapi import FastAPI, Request
from pydantic import BaseModel
from typing import List, Dict, Any, Union, Optional
from dash import Dash, html, Input, Output, ctx, set_props
import dash
from flask import Flask, has_request_context
import flask
from flask.testing import EnvironBuilder
from werkzeug.datastructures import Headers
@AnnMarieW
AnnMarieW / figure_friday_2024_week_32.py
Last active March 12, 2025 06:55
figure_friday_2024_week_32
# Plotly's Figure Friday challenge. See more info here: https://community.plotly.com/t/figure-friday-2024-week-32/86401
import dash
import pandas as pd
from dash import Dash, html, dcc, Input, Output, State, callback, Patch
import dash_bootstrap_components as dbc
import dash_ag_grid as dag
import plotly.graph_objects as go
app = Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
@AnnMarieW
AnnMarieW / figure_friday_2024_week_28
Last active July 19, 2024 00:44
Figure Friday 2004 Week 29 challenge
# Plotly's Figure Friday challenge. See more info here: https://community.plotly.com/t/figure-friday-2024-week-28/84980
import pandas as pd
import plotly.express as px
from dash import Dash, html, dcc, Input, Output
import dash_bootstrap_components as dbc
import dash_ag_grid as dag
import plotly
df = pd.read_excel(
import dash
from dash import Dash, dash_table, dcc, html
from dash.dependencies import Input, Output
import pandas as pd
import plotly.express as px
df = px.data.tips()
df["id"] = df.index
@AnnMarieW
AnnMarieW / datatable_icons.py
Created November 12, 2022 17:29
DataTable with icons
"""
See other MWEs for images and text icons here: https://github.com/plotly/dash-table/pull/916
Css in assets folder: (not tested yet maybe move the body font-size somewhere else since it will affect the entire app like this)
.cell-markdown > p {
display: flex;
height: 100%;
justify-content: center;
align-items: center;
@AnnMarieW
AnnMarieW / space_dependency_parse.py
Last active December 16, 2022 18:58
spacy named entities app
from dash import Dash, dcc, html, Input, Output
import dash_bootstrap_components as dbc
import spacy
from spacy import displacy
import base64
nlp = spacy.load("en_core_web_sm")
@AnnMarieW
AnnMarieW / set_drilldown_order.py
Last active October 24, 2022 18:05
Set drilldown order of bar charts and sunburst - Two versions
"""
From dash community question:
https://community.plotly.com/t/how-can-i-allow-users-to-select-which-comparison-variables-to-display-on-a-chart/69124
"""
from dash import Dash, html, dcc, Input, Output
import plotly.express as px
import pandas as pd
import dash_bootstrap_components as dbc
@AnnMarieW
AnnMarieW / live_crypto_prices_dark_theme.py
Last active October 12, 2022 18:22
Live Crypto prices Dark Theme
import dash
from dash import Dash, dcc, html, Input, Output
import dash_bootstrap_components as dbc
import requests
app = Dash(__name__, external_stylesheets=[dbc.themes.SUPERHERO, dbc.icons.BOOTSTRAP])
coins = ["bitcoin", "ethereum", "binancecoin", "ripple"]
interval = 6000 # update frequency - adjust to keep within free tier
api_url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd"
@AnnMarieW
AnnMarieW / ThemeSwitchAIO_with_grey_background.py
Created October 10, 2022 16:25
Sample App from HelloDash with ThemeSwitchAIO - How to make a light grey background
from dash import Dash, dcc, html, dash_table, Input, Output, callback
import plotly.express as px
import dash_bootstrap_components as dbc
from dash_bootstrap_templates import ThemeSwitchAIO
# select the Bootstrap stylesheet2 and figure template2 for the theme toggle here:
template_theme1 = "minty"
template_theme2 = "cyborg"
url_theme1 = dbc.themes.MINTY