I use R and ggplot2 for my publication style plots. It has everything that I want for this task. However, in the exploratory stage of the data I would like to have something which allows for some interactivity.

For example I have a data frame with various variables. These variables are of different types, namely :

  • Quantitative continuous,
  • quantitative discrete,
  • nominal, and
  • ordinal.

These variables can be mapped to aesthetics:

  • Position (all)
  • Hue (all)
  • Size (continuous, discrete, nominal)
  • Shape (ordinal)
  • Saturation (continuous, discrete, nominal)
  • Facets (nominal, ordinal)

With ggplot2, it is easy to produce a plot and mapping the variables (columns) of a data frame to these aesthetics:

ggplot(offensive, aes(x = Tons, y = Damage)) +
    geom_point(aes(color = Slots)) +
    red_green_gradient +
    facet_grid(Faction ~ Type, labeller = label_both)

enter image description here

The same data can also be displayed using different variables mapped to different aesthetics:

              Faction == 'Clan',
              Type == 'Ballistic'),
       aes(x = HPS, y = DPS)) +
    geom_point(aes(color = Tons, size = Slots)) +
    red_green_gradient +
    expand_limits(x = 0, y = 0) +
    geom_text_repel(aes(label = Name), point.padding = 1.5, box.padding = 0,
                    arrow = arrow(length = unit(0.01, 'npc'))) +
    labs(title = 'Clan Ballistic Weapons')

enter image description here

In this example I have also filtered the data to visualize only one subset of the above data.

This is all very great. But when I sit together with some other person, they usually want to look at the data in a different way. They will want to change the range of the axes, want different variables or different filters. Currently I have RStudio with Rmarkdown open and can just change the code and re-generate the plot.

But I wish for some software that would allow them to interactively explore the data set, something like this:

enter image description here

Using the drop-down they could easily change the axes, the sliders for the range. With the checkboxes they could put various variables on the other aesthetics. One can combine multiple nominal variables in a new nominal variable using R's interaction function, so I want checkboxes and not just radio buttons. One would have to carefully allow the options there, but this should be a solvable problem. It would be great if it runs completely in a web browser without a fancy server backend.

Ideas so far:

  • R Shiny. This seems to be a close fit. I could generate the UI within R and therefore expose all the variables in the data frame as UI elements. Also I could try to classify the data and allow it for useful aesthetics.

    Filtering would also be possible using R's dplyr library. There in the UI Code I could just offer drop-downs which allow to select one particular value or not filter in this variable. This should be enough flexibility.

    Advantage is that it seems to be doable and I do not have to learn JavaScript to implement it. The plots are still done with ggplot2 on the server and then sent to the client.

    The drawback is that it needs an R backend, which I cannot host on my shared hosting website. It is still viable to use in a group meeting or presentation, but setting this up such that other people can play with it on their machine would require some hosting service. This might be worth it, but perhaps not my first choice.

  • D3. It is a pure JavaScript implementation, but it likely is too general to give me what I want quickly. My idea could certainly be implemented, but I fear that I just do not want to invest the time.

  • Bokeh. It seems to provide more of the things that I want. It seems to use Python as a back-end, which is okay as I sufficiently know that language. However, it seems to require a back-end, and therefore is on par with R Shiny in this regard. The callback functions might be implementable in pure JavaScript; if so, it might run without a server.

Are there other options that I missed?

1 Answer 1


I would suggest that you spend some time looking at Jupyter Notebooks as this gives you a lot of possibilities:

  • You can develop your code in Python, R or a mixture of the two by locally hosting the Jupyter session(s).
  • You can embed charts, videos, etc. in your notebook, (as well as the code and the text as markdown).
  • You can embed Jupyter Widgets, among other options, to allow control of the charts as you describe above.
  • You can publish you notebooks to pdf file, (with the charts fixed of course).
  • When you wish to share your Notebooks locally you simply start the Jupyter server with an accessible IP address as documented here or host a JupyterHub.
  • If you need to share your notebooks to a wider audience there are a number of hosting services, (free & paid), that will let you serve Jupyter notebooks, with the interactivity enabled. e.g. Microsofts Azure Jupyter Hosting currently free, Binder, currently free, Anaconda Cloud, AWS, etc.
  • You can also consider using a hosted docker instance as a server, e.g. on Google Cloud, AWS, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.