Some forks and experiments with the very fine work from Ben Moore http://rcharts.io/viewer/?6c9ed5eed37fe3c03fa5. For details on the original, please see the author's blog post http://benjaminlmoore.wordpress.com/2014/05/05/what-are-the-most-overrated-films/.
example.md: example.Rmd | |
Rscript ./knit | |
example.ipynb: example.md | |
c://python27_64/scripts/notedown example.md | sed 's/%%r/%%R/' > example.ipynb |
hair_eye_male = subset(as.data.frame(HairEyeColor), Sex == "Male") | |
n1 <- nPlot(Freq ~ Hair, | |
group = 'Eye', | |
data = hair_eye_male, | |
type = 'multiBarChart' | |
) | |
n1 |
library(rCharts) | |
p2 <- nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'scatterChart') | |
p2$xAxis(axisLabel = 'Weight') | |
p2$chart(size = '#! function(d){return d.gear} !#') | |
p2$chart(color = c('red', 'green', 'blue')) | |
p2$chart( | |
tooltipXContent = NA, | |
tooltipYContent = NA | |
) | |
p2$chart( |
#setwd('~/uhk/dev/ar_ondrej_plachy/institution/') | |
data = read.table('data.tsv',sep="\t",header=TRUE) | |
data$time = data$year - 1983 | |
data$random1 = rnorm(336, mean=0, sd=0.01) | |
data$random2 = rnorm(336, mean=0, sd=0.01) | |
attach(data) | |
fbalm2 = | |
ifelse(balance_of_parties_mandates<= 0.25, '0.0-0.25', | |
ifelse(balance_of_parties_mandates <= 0.5, '0.25-0.5', |
This example pulls together various examples of work with trees in D3.js.
The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.
One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.
Dragging can be performed on any node other than root (flare). Dropping can be done on any node.
Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.
Forked from Mike Bostock's brush as slider example, I use the brush/slider to drive an interactive exploration of the US Yield Curve. I think this is a much more helpful way of showing the data than the animated GIF from Treasury yield curve from the Volcker era through Greenspan, Bernanke, and Yellen.
By customizing the display of D3'��s [brush component](https://github.com/mbostock/d3/wiki/SVG-Controls), you can make a single-handle slider. Or, by using [custom resize handles](/mbostock/4349545), you can make a two-handled slider.#Run hclust | |
hc <- hclust(dist(USArrests[1:40,]), "ave") | |
#Function for extracting nodes and links | |
extractGraph<-function(hc){ | |
n<-length(hc$order) | |
m<-hc$merge | |
links<-data.frame(source=as.numeric(), target=as.numeric(), value=as.numeric()) |
/** | |
* Copyright (c) 2014, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
#main { |