WARNING: This version of D3partitionR is outdated, you can find the latest version here on GitHub and see a quick overview of the last version here.

My new package D3partitionR (V0.1) has just been released on CRAN: Here

The git project can be found here

What does it do ?

D3partitionR is an R package to plot several types of interactive plots (using d3js):

  • Sunburst
  • Partition Layout Chart
  • Treemap
  • Circle Treemap

 

All these charts are used to plot hierarchical or sequential data:

  • Sequential: Step A -> step B -> step C -> … and so on with several sequences
  • Hierarchical: Set C is in Set B which  is in set A

As you can see, both these data can be represented using lists:

  • [Step A, Step B, Step C]
  • [Set A, Set B, Set C]

Thus, the same package and the same functions are to be used to plot these data.

How does it work ?

The package has been thought to be easy to use. It’s only going to take you one single function to create these visualisations !

Input data

The input data are going to be a list of two list:

  • The list of the different (and unique) paths
  • The value of these paths (i.e. the size of the sets, the number of people using this path and so on …)

EX:

path_in=list(list("A","B","C","D"),list("A","B","F","G"),list("A","D"),list("A","B","END"))
value_in=c(15,29,21,34)
D3partitionR(data=list(path=path_in,value=value_in))

Will build:

Bubble.png

Types of visualisation:

The package gets you access to several type of visualisations, and has a type argument:

D3partitionR(data=list(path=path_in,value=value_in),type="sunburst")
D3partitionR(data=list(path=path_in,value=value_in),type="treeMap")
D3partitionR(data=list(path=path_in,value=value_in),type="partitionChart")

The different options will respectively gets you a sunburst, a treemap and a partitionChart.

Title and legend:

You can easily add a title through:

D3partitionR(
data=list(path=path_in,value=value_in),
type="treemap",title=list(text="My title")
)

Adding a legend is also easy, you have to specify some colors for some of your steps/sets and to chose the type of legend you want (sequential or categorical).

D3partitionR(
 data=list(path=path_in,value=value_in),title=list(text="My title"),
 legend=list(type="sequential",color=list(B="#e8ae46",D="#bf3a8e"))
 )

2016-10-02 17_38_15-RStudio.png

What’s next ?

  • More options for title, labels and legend
  • Adding new type of “partition” charts
  • Adding the possibility to use the charts as an input
  • Fixing bugs (there will be some !)
  • And any other suggestions is more than welcomed !
Advertisements