Skip to content

Commit

Permalink
Improve gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 23, 2023
1 parent 6f186e2 commit 33ddf57
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 1 deletion.
30 changes: 30 additions & 0 deletions examples/gallery/anaconda-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: lumen_gallery
description: An environment to serve all Lumen gallery examples

commands:
default:
description: Serve the Lumen gallery
unix: lumen serve */*.yaml --reuse-sessions --global-loading-spinner --liveness --num-procs 4
supports_http_options: true

channels:
- pyviz/label/dev
- conda-forge

variables:
PANEL_AE5_CDN: 1
MPLBACKEND: Agg

packages:
- lumen
- panel
- hvplot
- datashader
- fastparquet
- altair
- numba::llvmlite
- python-duckdb
- s3fs

env_specs:
default: {}
2 changes: 1 addition & 1 deletion examples/gallery/earthquakes/earthquakes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ layouts:
streaming: true
depth_hist:
type: hvplot
pipeline: selected
pipeline: earthquakes
kind: hist
y: depth
fill_color: white
Expand Down
134 changes: 134 additions & 0 deletions examples/gallery/windturbines/windturbines.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
config:
title: Windturbine Database Viewer
theme: dark
template: material
sources:
windturbines:
type: duckdb
cache_dir: ./cache
uri: ":memory:"
tables:
windturbines: "read_parquet('s3://datasets.holoviz.org/windturbines/v1/windturbines.parq')"
initializers:
- "INSTALL httpfs;"
- "LOAD httpfs;"
variables:
state:
type: url
color_by:
type: widget
kind: panel.widgets.Select
options:
- t_manu
- t_year
value: t_manu
pipelines:
continental:
source: windturbines
filters:
- type: constant
field: xlong
value: [-125, -66]
- type: constant
field: ylat
value: [24, 50]
- type: constant
field: t_state
value: $variables.state
windturbines:
pipeline: continental
filters:
- type: widget
field: t_state
- type: widget
field: t_manu
- type: widget
field: p_year
- type: widget
field: t_cap
filtered:
pipeline: windturbines
filters:
- type: param
parameter: points.selection_expr
table:
pipeline: filtered
transforms:
- type: columns
columns: [t_state, t_county, p_name, t_manu, t_model, p_year, t_cap, t_hh, t_rd, t_rsa, t_ttlh]
count:
pipeline: filtered
transforms:
- type: count
- type: rename
columns:
case_id: Count
sum:
pipeline: filtered
transforms:
- type: columns
columns:
- t_cap
- type: sum
- type: eval
expr: "Capacity = table.t_cap / 10**6"
layouts:
- title: Overview
layout: [[points, [count, capacity]], [table, [cap_hist, year_hist]]]
sizing_mode: stretch_width
views:
points:
type: hvplot
kind: points
pipeline: windturbines
x: easting
y: northing
c: $variables.color_by
tiles: ESRI
rasterize: true
dynspread: true
responsive: true
height: 500
xaxis: null
yaxis: null
streaming: true
selection_group: windturbines
table:
type: table
pipeline: table
header_filters: true
sizing_mode: stretch_width
height: 500
page_size: 20
count:
type: indicator
indicator: number
pipeline: count
field: Count
format: '{value:,}'
width: 300
default_color: white
capacity:
type: indicator
indicator: number
pipeline: sum
field: Capacity
format: '{value:.0f} TWh'
width: 300
default_color: white
cap_hist:
type: hvplot
kind: hist
pipeline: windturbines
y: t_cap
frame_width: 400
height: 250
selection_group: windturbines
year_hist:
type: hvplot
kind: hist
pipeline: windturbines
y: p_year
frame_width: 400
height: 250
selection_group: windturbines

0 comments on commit 33ddf57

Please sign in to comment.