D3partitionR: Overview

6

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 !

6 COMMENTS

  1. Your package looks great, but having some trouble getting it to work. The example on this page throws an error – “Error in sum(list_rec_value) : invalid ‘type’ (list) of argument”.

  2. Hello,
    This is a great package, thank you for your work. I like the bubbles visual a lot, but I have one concern: the size of the bubbles is not related to the cumulated values of the leaves (it seems to be determined by the number of subtrees). This can be very misleading as the biggest bubble is not the biggest subtree.
    By any chance, would there be a parameter that would enable to fix this?
    Philippe

LEAVE A REPLY

Please enter your comment!
Please enter your name here