A pick of the best R packages for interactive plot and visualisation (2/2)

[This article was first published on Enhance Data Science, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In the first part of A pick of the best R packages for interactive plot and visualization, we saw the best packages to do interactive plot in R. Now, let’s see what are the best packages for interactive visualizations.

While plots tend are representing ‘classic’ data. These plots have an x-axis a y-axis and one or two other variables represented as colors, size or symbols. Visualizations are to represent data that are not structured in a ‘regular’ way, for instance:

  • Network and graph data (for instance social network connections)
  • Sequential data (for example a consumer journey on a website or in a shop)
  • Hierarchical data (to represent group imbricated like a Russian Doll)
  • Textual data

Network and graph data

  • NetworkD3 : This package is a wrapper for d3 network plots, it will hell you draw simple and force-directed network, Sankey diagrams and dendrogram network. The overall syntax is easy, you need to provide the list of nodes and the list of links. For instance this code snippet (from the package github) will draw a force-directed plot:
# Load data
# Plot
forceNetwork(Links = MisLinks, Nodes = MisNodes,
            Source = "source", Target = "target",
            Value = "value", NodeID = "name",
            Group = "group", opacity = 0.8)


  • visNetwork : This library is base on the vis.js javascript library. The syntax to create the networks is close to the networkD3 one and this package also has a lot of options:
    • Trigger an action when selecting a node
    • graph edit with an interactive menu
    • interface with igraph
    • Highlight by groups, nodes id, closest neighbors, …

Sequential data

By sequential data, we mean a sequence of different actions, page visited or a conversion funnel for instance.

  • SunburstR from timely portfolio. This package is a wrapper for sequential sunburst in D3.js, you can see an example here. Sunbursts are an awesome way to visualize sequences and will make the easier to understand for your audience.
    Thanks to the package, you will need to change your path to a sequence of shape ‘Step A – Step B – Step C’ and to count the number of visits on this given sequence, then the wrapper will do the work for you!
  • D3partitionR also offers a way to plot a Sunburst with D3.js, this time the sunburst is zoomable. Hence, the package is useful for long sequences since zooming will allow you to place the root of the sunburst further in the sequence.

Hierarchical data

Hierarchical data are data structured like nested lists (basically trees).

  • d3Tree : This package use D3.js and its tree structure to plot interactive tree. The main advantage of the package is the possibility to use the tree as an interactive filter for your data. The data conversion is easy with a dedicated function which also let you choose a tooltip column.
  • d3treeR, by timely portfolio, is a wrapper for D3.js treemap. Again the syntax is convenient to use.
  • d3PartitionR: This package is specialized in plotting hierarchical data using treemaps, circle treemaps, and collapsible trees. This is basically a D3.js wrapper for R and has several options:
    • Legend and tooltip customisations
    • Possibilities to use the interactive plot as a Shiny input and hence do filtering

Textual data

Textual data are often used to do text analysis or sentiment analysis.

  • Wordcloud2: This library helps you to create interactive wordcloud. The library is really great and will help you to create complexe word cloud:
    • Specific shape using a .png (you can replicate the twitter bird)
    • Shape using a word, your wordcloud will follow the shape of a given word
    • Color selection background selection, ….
  • ggplot2 + plotly: Ggplot and plotly can also be used to plot word projection in a vector space after using PCA or t-sne. This was the technique used  in the semantic analysis of Twitter.

If you like this post, you can follow our newsletter:

The post A pick of the best R packages for interactive plot and visualisation (2/2) appeared first on Enhance Data Science.

To leave a comment for the author, please follow the link and comment on their blog: Enhance Data Science.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)