Skip to main content

d3js

Project description

This is a really thin shiv that lets you run static d3js scripts to produce SVG / HTML outputs in your Jupyter notebooks. Underneath the covers, it uses d3-node.

Why is this?

Because it makes writing my dissertation easier. I have some dynamic visualizations that are d3-based. But, for the write-up, I also have static snapshots as illustrations. This is my DRY hack. It let’s me reuse the code in a way that isn’t terribly intrusive. (Well, that, and I don’t like out-of-Jupyter-core JS in my notebooks.)

Installation

Assuming you have node and yarn,

pip install d3nb

Usage

The following snippet runs the given cell source with my_node_project_dir as the working directory, then outputs the SVG. If that directory doesn’t exist, you can run the initial cell magic line as, %%d3nb_svg my_node_project_dir --init to set it up.

%%d3nb_svg my_node_project_dir
var D3Node = require('d3-node')
var d3 = require('d3')
var d3n = new D3Node()
var svg = d3n.createSVG()

// See: https://www.npmjs.com/package/d3-node
// ...

console.log(d3n.svgString())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

d3nb-0.0.2.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file d3nb-0.0.2.tar.gz.

File metadata

  • Download URL: d3nb-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for d3nb-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6bc3bbfb9550fef66ff98358e36975304feb7a354a839b2aa3e9656b624c884e
MD5 06d25630d871fefd661450c79d305980
BLAKE2b-256 73b5bf722eccdb6d32c16d0cc7280a03b0c7839ed539bb6d4fc8e9b947b67067

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page