Public
Edited
Apr 12, 2022
Insert cell
Insert cell
<svg id="base" width="1000" height="3500">
<g id="layer1"></g>

<style>
.link {fill:none; stroke: #aaa}
.node circle {stroke: #aaa;}
.node text {font-size: 10px; fill: white; text-anchor: middle}
.COAL {fill:#000000; background-color:#000000; color: #dddddd;} /* black */
.BIOMASS {fill:#00ff00; background-color:#00ff00;} /* green */
.HYDRO {fill:#0000ff; background-color:#0000ff; color: #dddddd;} /* blue */
.OIL {fill:#777700; background-color:#777700;} /* brown */
.GAS {fill:#E8BD0C; background-color:#E8BD0C;} /* orange */
.NUCLEAR {fill:#00ffff; background-color:#00ffff;} /* cyan */
.GEOTHERMAL {fill:#A6A277; background-color:#A6A277;} /* brown */
.WIND {fill: #FF66FF; background-color: #FF66FF;} /* pink */
.SOLAR {fill: #ffff00; background-color: #ffff00;} /* yellow */
.OFSL {fill: #888888; background-color: #888888;} /* gray */
.OTHF {fill: #aa0000; background-color: #aa0000;} /* gray */
.OTHRFOSL {fill: #888888; background-color: #888888;} /* gray */
.WSTHTOTPUR {fill: #aa0000; background-color: #aa0000;} /* gray */
</style>
</svg>
Insert cell
Insert cell
Insert cell
rollupData = d3.rollups(powerplants_2019, v => d3.sum(v, d => toNum(d["Plant annual net generation (MWh)"])), d => d["Plant state abbreviation"], d => d["Plant primary fuel generation category"]);
Insert cell
Insert cell
import {layoutChildren} from "@emfielduva/dvlib_layout"
Insert cell
dataLayout = layoutChildren("powerplants", rollupData)
Insert cell
### and then we draw
using the `dvClusterDendogram` convenience function from my library.
format: `dvClusterDendogram(elem,data,sizeX,sizeY,scaleR)`
Insert cell
denElem = d3.select(svgContainer).select("#layer1")
Insert cell
dendo = dvClusterDendogram(denElem,dataLayout,3500,800,0.005)
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more