This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
function pointIsInArc(pt, ptData, d3Arc) { | |
// Center of the arc is assumed to be 0,0 | |
// (pt.x, pt.y) are assumed to be relative to the center | |
var r1 = arc.innerRadius()(ptData), // Note: Using the innerRadius | |
r2 = arc.outerRadius()(ptData), | |
theta1 = arc.startAngle()(ptData), | |
theta2 = arc.endAngle()(ptData); | |
var dist = pt.x * pt.x + pt.y * pt.y, | |
angle = Math.atan2(pt.x, -pt.y); // Note: different coordinate system. |
g.append("text") | |
.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; }) | |
.attr("dy", ".35em") | |
.style("text-anchor", "middle") | |
.text(function(d) { return d.data.age; }) | |
.each(function (d) { | |
var bb = this.getBBox(), | |
center = arc.centroid(d); | |
var topLeft = { |
A demo for the circle-text plugin, which can place text aligned along the bottom of circles.
This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
This is an adaption of a Zoomable sunburst example with an added text box showing which item was last clicked.
Click on any arc to zoom in. Click on the center circle to zoom out.
A sunburst is similar to a treemap, except it uses a radial layout. The root node of the tree is at the center, with leaves on the circumference. The area (or angle, depending on implementation) of each arc corresponds to its value. Sunburst design by John Stasko. Data courtesy Jeff Heer.
The script json2sqlite.py
reads files which have one JSON block per new line to be inserted in a database.
This has become a rather common dataformat which is easy to incrementally parse.
The arguments to the scripts are self explanatory.
Example execution: python json2sqlite.py --gzip aggressive_dedup.json.gz amazon.sqlite reviews
For a more upto date scripts, see: Networks-Leraning/datasets2sqlite.
# Copy this to your .Rprofile | |
library('colorout') | |
setOutputColors256( | |
normal = 40, | |
number = 214, | |
string = 85, | |
const = 35, | |
stderror = 45, | |
error = c(1, 0, 1), | |
warn = c(1, 0, 100) |
From 15b12ffc5b4b22ab104cf796e7173db4eeaefe90 Mon Sep 17 00:00:00 2001 | |
From: Utkarsh Upadhyay <musically.ut@gmail.com> | |
Date: Fri, 2 Mar 2012 11:56:32 +0530 | |
Subject: [PATCH] Notification rating plugin. | |
--- | |
data/org.gnome.rhythmbox.gschema.xml | 10 + | |
plugins/notification/Makefile.am | 6 + | |
plugins/notification/notification-preferences.ui | 28 +++ | |
plugins/notification/rb-notification-plugin.c | 243 ++++++++++++++++++++- |
def intersects(line_1, line_2): | |
"""Whether line_1 and line_2 intersect or not.""" | |
A, B = line_1 | |
C, D = line_2 | |
if _ccw(A,C,D) != _ccw(B,C,D) and _ccw(A,B,C) != _ccw(A,B,D): | |
# If the triangle pairs ACD, BCD and ABC, ABD have different | |
# orientations, then the segments have to intersect | |
return True | |
for pt in line_2: |