Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R interactive plot?

How can a user interactively change one aspect (e.g., orientation or length of a line) on a 2D plot?

like image 925
Adam SO Avatar asked Jan 18 '11 20:01

Adam SO


People also ask

Can Ggplot be interactive?

This static ggplot2 chart can quickly be made interactive by simply placing it inside the ggplotly function (after installing and loading plotly). The static plot has now been brought to life. Users can now zoom, hover, pan and export the plot, and more.

What are interactive plots?

Interactive visualizations are produced using data visualization tools which allow for direct modification of elements on a graphical plot. The idea is to create charts and graphs which the end-user will be able to personally explore and adjust and not just read passively.


2 Answers

latticist and playwith are offering the interactive functionality for R's statistical plots.

For modifying specific details you can save the graph in SVG format and edit it in inkscape.

like image 84
VitoshKa Avatar answered Oct 03 '22 01:10

VitoshKa


The rpanel package has worked for me.

library(rpanel)    

lvm.draw <- function(panel) {    
  x=0:20    
  plot(x, panel$int + (panel$slo*x), ylim=panel$data, ylab="y", main="Adam's Super Duper Interactive Graph", typ="l", lwd=3, col="red")    
  grid()    
  panel    
}    

ylimdat<-c(-50,50)    
panel <- rp.control(title = "Adam's Panel", data=ylimdat, slo=0.5, int=1.0, size=c(300, 160))    
rp.slider(panel, var=slo, from=-5, to=5, action=lvm.draw, title="Slope", pos=c(5, 5, 290, 70), showvalue=TRUE)    
rp.slider(panel, var=int, from=-50, to=50, action=lvm.draw, title="Intercept", pos=c(5, 70, 290, 90), showvalue=TRUE)    
like image 21
bill_080 Avatar answered Oct 03 '22 01:10

bill_080