Skip to content

Instantly share code, notes, and snippets.

@jun9
jun9 / points.r
Last active December 24, 2015 21:19 — forked from hadley/points.r
library(ggplot2)
library(scales)
library(maps)
library(plyr)
mid_range <- function(x) mean(range(x, na.rm = TRUE))
centres <- ddply(county_df, c("state", "county"), summarise,
lat = mid_range(lat),
long = mid_range(long)
)
@jun9
jun9 / README.md
Last active December 17, 2015 15:29
DC.js chart example: Shanghai SSE Composite Index

dc.js - Dimensional Charting Javascript Library v1.3.0

The following charts provide a live example of dc.js used against Shanghai SSE Composite Index (000001.SS) for the last 23 years. (You can run this example completely off-line). Although it is just an example, using it you can already ask some quite interesting questions.

Try it out or checkout other examples.

@jun9
jun9 / index.html
Created May 23, 2013 00:24
dc.js - Dimensional Charting Example: Shanghai SSE Composite Index 1990/12/19-2013/05/22
<!DOCTYPE html>
<html lang="en">
<head>
<title>dc.js - Dimensional Charting Javascript Library</title>
<meta charset="UTF-8">
<link href="http://jun9.github.io/dc.js/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="http://jun9.github.io/dc.js/css/dc.css"/>

This parallel coordinates visualization of cars from the ‘70s and ‘80s demonstrates one of D3 2.5.0’s new interactive features: the brush component. By clicking and dragging along any axis, you can specify a filter for that dimension. The brush component is also used in the updated scatterplot matrix example.

@jun9
jun9 / README.md
Created May 22, 2013 18:16 — forked from mbostock/.block

The first 15 seconds of the D3 show reel. See full video at http://vimeo.com/29862153. Includes seamless transitions between the following visualization types:

  • lines
  • horizons
  • areas
  • stacked areas
  • streamgraph
  • overlapping areas
  • grouped bars
  • stacked bars
@jun9
jun9 / README.md
Created May 22, 2013 18:11 — forked from mbostock/.block

The scatterplot matrix visualizations pairwise correlations for multi-dimensional data; each cell in the matrix is a scatterplot. This example uses Anderson's data of iris flowers on the Gaspé Peninsula. Scatterplot matrix design invented by J. A. Hartigan; see also R and GGobi. Data on Iris flowers collected by Edgar Anderson and published by Ronald Fisher.

@jun9
jun9 / gist:4259182
Created December 11, 2012 15:07 — forked from jcbagneris/gist:4250572
Coursera Computational Finance Course - HW3 helper
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Comp. Finance Course HW3 : Simulator
"""
import argparse as ap
import datetime as dt
import pandas as pd
import qstkutil.qsdateutil as du
@jun9
jun9 / server.R
Created November 21, 2012 03:26 — forked from jean-robert/server.R
Prime Factorization Visualization in R and Shiny
library(shiny)
library(gmp)
drawStar <- function(center, length, pts, direction=0, segments=F, colour=F) {
if(length(pts)==0) return()
if(segments & (pts[1]==2)) direction <- direction + pi/2
for(i in 1:pts[1]) {
point <- center +
length*c(cos(direction+pi/2+i*2*pi/pts[1]),
sin(direction+pi/2+i*2*pi/pts[1]))
@jun9
jun9 / README.md
Created November 21, 2012 03:09 — forked from mbostock/.block
Bullet Charts

Designed by Stephen Few, a bullet chart “provides a rich display of data in a small space.” A variation on a bar chart, bullet charts compare a given quantitative measure (such as profit or revenue) against qualitative ranges (e.g., poor, satisfactory, good) and related markers (e.g., the same measure a year ago). Layout inspired by Stephen Few. Implementation based on work by Clint Ivy, Jamie Love of N-Squared Software and Jason Davies. The "update" button randomizes the values slightly to demonstrate transitions.

@jun9
jun9 / create_php_site.sh
Created September 17, 2012 11:57
Nginx and PHP-FPM, bash script for creating new vhost’s under separate fpm pools
#!/bin/bash
# @author: Seb Dangerfield
# http://www.sebdangerfield.me.uk/?p=513
# Created: 11/08/2011
# Modified: 07/01/2012
# Modified: 17/05/2012
# Modify the following to match your system
NGINX_CONFIG='/etc/nginx/sites-available'
NGINX_SITES_ENABLED='/etc/nginx/sites-enabled'