1

i have a problem in scatterd3plot, i want to draw a line of mean data x and data y, so i have a quadrant line in my plot using scatterd3. but i have no idea how to create a line in scatterd3, i have try search in internet how the solution, but i dont found it. this is the code...

   library(scatterD3)
    datax <- runif(20, 5.0, 7.5)
    datay <- runif(20, 25, 30)
    scatterD3(x = datax, y = datay, xlab = "x", ylab = "y",  labels_size = 9, lasso=TRUE, transitions = TRUE)
  • I don't think you can. Looks like the package was specifically designed to create interactive scatterplots only. Try ggvis, ggplot2, or plotly instead. – royr2 May 10 '16 at 06:48

1 Answers1

0

It is now possible to add arbitrary lines to a scatterD3 scatterplot since version 0.7.

To do this, you must add a lines argument to your scatterD3 call. This argument must be a data frame with at least a slope and an intercept columns. You can add several lines to the data frame to define as many lines in your plot.

Here's a simple example :

scatterD3(data = mtcars, x = wt, y = mpg, fixed = TRUE, 
          lines = data.frame(slope = 1, intercept = 0))

You can find more information on styling the lines in the introduction vignette :

https://cran.r-project.org/web/packages/scatterD3/vignettes/introduction.html#adding-lines

juba
  • 47,631
  • 14
  • 113
  • 118