简体   繁体   中英

Linked brushing possible in R

I saw this just yesterday but it's for matplotlib which, as far as I know, is Python only. This functionality that would be stupendously useful for my work.

Is anything similar available for R? I've looked around and the closest I've seen mentioned is iPlots/Acinonyx, but the websites for those are a few years out of date. Do those packages work reasonably well? I've not seen any examples of their use.

Alternatively, does mpld3/matplotlib/python play well with R? By that I mean, could I load my dataframes in R, use mpld3/matplotlib/python for exploring my data, then making up final/pretty plots in R?

Full disclosure: I'm a newbie (R is the first programming language that I've really tried to learn since QBASIC as a child...).

While R doesn't seem to have anything quite like this yet, I want to note that mpld3 now has a well-defined JSON layout for figure representations, in some ways similar to Vega (but at a much lower level). I'm not an R/ggplot user, but it seems like the ggvis ggplot-to-vega approach could be rather easily adapted to convert from ggplot to mpld3.

I've forgotten how to do linked plots with brushing in R, but I know the capability is there. I use GGobi for that, however - http://ggobi.org/ . It's designed for exploratory data analysis using visualizations, and there are R packages to communicate with it and script it.

There's a pretty good book on GGobi - Interactive and Dynamic Graphics for Data Analysis: With R and GGobi .

The R package ggvis will have similar functionality. It is still in relatively early development, as version 0.1 was just tagged a few days ago. (Although that's also true of mpld3 ).

To answer your second question, yes they work reasonably well together. The easiest way to do what you suggested would use the R magic function in the IPython notebook.

The package JGR provides a java interface for R. From here, you can call the library iplots. In your R terminal, type

install.packages("JGR");
library(JGR);
JGR()

This will open a new window that you can use just like the standard R terminal.
You should now be able to brush using iplots:

X = matrix(rnorm(900), ncol = 3);
iplot(X[,1], X[,2]);
iplot(X[,1], X[,3]);
ihist(X[,1])

另外请看一下http://cranvas.org/ - 它可能有点难以安装(特别是对于新手),但值得付出努力。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM