Description Usage Arguments Examples
d3tree
is the primary function for creating interactive d3.js treemaps from
various data types in R. Easily use treemap
plots customized with
treemap
, or supply a list
for a more typical d3.js
experience, or
blend the two.
1 2 |
data |
the data to be plotted as either
the result of |
rootname |
|
id |
|
celltext |
|
valueField |
|
width,height |
a valid |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ## Not run:
##### designed to work seamlessly with treemap
library(treemap)
library(d3treeR)
# example 1 from ?treemap
data(GNI2010)
d3tree(
treemap(
GNI2010
,index=c("continent", "iso3")
,vSize="population"
,vColor="GNI"
,type="value"
)
, rootname = "World"
)
## End(Not run)
# last example from ?treemap
data(business)
# Brewer's Red-White-Grey palette reversed with predefined range
business$employees.growth <- business$employees - business$employees.prev
d3tree(
treemap(business,
index=c("NACE1", "NACE2"),
vSize="employees",
vColor="employees.growth",
type="value",
palette="-RdGy",
range=c(-30000,30000))
, rootname="Fictitious Business Data"
)
####
#### also works with d3.js json
library(d3tree)
d3tree(
"http://bl.ocks.org/mbostock/raw/4063269/flare.json"
,id = "name"
)
####
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.