Skip to content

Instantly share code, notes, and snippets.

View eglassman's full-sized avatar
💭
I may be slow to respond.

Elena Glassman eglassman

💭
I may be slow to respond.
View GitHub Profile
@eglassman
eglassman / .block
Created January 18, 2017 21:24 — forked from mbostock/.block
Radial Stacked Bar II
license: gpl-3.0
height: 960
@eglassman
eglassman / .block
Created January 18, 2017 21:23 — forked from mbostock/.block
Radial Stacked Bar III
license: gpl-3.0
height: 960
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@eglassman
eglassman / README.md
Last active August 29, 2015 14:14 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
from descartes import PolygonPatch
import fiona
from shapely.geometry import Polygon, MultiPolygon, shape
# We can extract the London Borough boundaries by filtering on the AREA_CODE key
mp = MultiPolygon(
[shape(pol['geometry']) for pol in fiona.open('data/boroughs/boroughs.shp')
if pol['properties']['AREA_CODE'] == 'LBO'])
#adapted from minus_context
import nltk
import feedparser
import random
import twitter
import yaml
import string
import re
from urlparse import urlparse
@eglassman
eglassman / popoverDemo.html
Created July 28, 2014 02:33
A popover configuration I like
<html>
<head>
<style>
body {padding:50px}
</style>
<!-- Latest compiled and minified CSS -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
@eglassman
eglassman / README.md
Last active August 29, 2015 14:04
Block

I would like to ink on some d3-created visualizations. I really like d3, so I thought I'd create the inking with it too, instead of introducing another library into my project.

However, I could only find one demo of d3-based inking: a block on bl.ocks.org by 'cloudshape'.

It was almost exactly what I wanted, except there was this strange offset between where I placed my mouse, and where the line was drawn. So... I copied the code into Brackets and modified it until this offset was gone. I think it's a small but significant improvement. Now I'm sharing it as a 'block' of my own!

Cloudshapes, thank you so much for creating the original drawing app. You did all this work, and I am grateful. I just changed one line of code!

{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},