Skip to content

Instantly share code, notes, and snippets.

View yang-qian's full-sized avatar

Qian yang-qian

View GitHub Profile
@cmdoptesc
cmdoptesc / d3.slider.css
Last active April 6, 2020 09:50
D3: Map Timeline
.d3-slider {
position: relative;
font-family: Verdana,Arial,sans-serif;
font-size: 1.1em;
border: 1px solid #aaaaaa;
z-index: 2;
}
.d3-slider-horizontal {
height: .8em;
@mdml
mdml / README.md
Last active March 30, 2023 16:30
Dendrograms: Convert from Scipy to D3

A dendrogram is a common way to represent hierarchical data. For Python users, Scipy has a hierarchical clustering module that performs hierarchical clustering and outputs the results as dendrogram plots via matplotlib. When it's time to make a prettier, more customized, or web-version of the dendogram, however, it can be tricky to use Scipy's dendrogram to create a suitable visualization. My preferred method of visualizing data -- especially on the web -- is D3. This example includes a script to convert a Scipy dendrogram into JSON format used by D3's cluster method.

In the example, I cluster six genes by their expression values from two experiments. You can easily replace that data with your own, larger data set, to harness the power of both Scipy and D3 for analyzing hierarchical data. The D3 code I used to generate this example is straigh

@jerivas
jerivas / twin_motor_control.ino
Last active December 20, 2022 23:18
Control two stepper motors' speed and direction with two analog inputs (joystick). By Eduardo Rivas, David Escobar and Ángel Moreno for Universidad Don Bosco de El Salvador, 2013.
/*
Dual Stepper Motor Control (Arduino UNO R3)
Controls the speed and direction of two stepper motors
via two analog inputs. Used to achieve two-dimensional
movement controlled by a joystick. End-of-track sensors
prevent damage to the structure and motors.
Based on "Speed Control" example of the Stepper lib.
Please note the Stepper library produces a bipolar sequence.
By swapping the two middle cables, a unipolar seq. is obtained.
@mbostock
mbostock / .block
Last active June 21, 2023 17:50
Zoomable Map Tiles
license: gpl-3.0
redirect: https://observablehq.com/@d3/zoomable-map-tiles