A new R package for labeled scatterplots and bubble charts

April 26, 2017
By

(This article was first published on R – Displayr, and kindly contributed to R-bloggers)

Scatterplots

 

Image-labelled soda can trend arrows

The rhtmlLabeledScatter package on github attempts to solve three chronic challenges with labeled scatterplots: readability with large numbers of labels, bubbles, and the use of images.

 


Four tools for dealing with overlapping labels

1. Automatically arranging labels so they do not overlap

If you look at the scatterplot below, you should immediately see the most obvious way that the package deals with overlapping labels: labels are automatically re-arranged so that they do not overlap. Lines connect labels to their points.


2. Viewers can move labels using drag-and-drop

The second tool for dealing with overlapping labels is that they are draggable. If you are viewing this visualization using a device with a mouse, you can click on the labels to rearrange them to make them even more readable. If you do this using a software platform that can remember the state of an HTMLwidget, such as Displayr, the final position where you leave a label is remembered.


3. Labels can be be dragged off the plot

The third tool is that you can drag the labels off the plot, which causes them to be added to a legend. A notation on the relevant axis shows the direction of any removed labels (try this for yourself).


4. Tooltips on hover

The fourth tool for addressing overlapping labels is the use of tooltips. Hover your mouse over any point and you can see its label.


Bubble charts

The four tools for addressing overlapping labels are also all available for bubble charts, as illustrated below.

 


Images

It is possible to use images on the scatterplots. Automatically rearranging the images avoids overlaps, as shown in the example below.

 


Trend arrows

The last example, shown below, uses trends to show movement over time on the scatterplot.

 


The source code

Click here to login to Displayr and access the R source code (click on a chart, and from the object inspector, select Properties > R CODE).

To leave a comment for the author, please follow the link and comment on their blog: R – Displayr.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

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)