Search code examples
rplotlylarge-datargl

Interactive plotting of large data (few millions) with R


I am trying to visualize several hours of neuronal recordings sampled at 500Hz using R in Ubuntu 16.04. Simply I want to have a 2D plot that shows a value (voltage) over time. Its important for to have the plot in an interactive way. I need to have an overall look, compare different times and zoom in and out, therefor I don't want to split my data into different parts and visualize them separately.(Also I can not use the normal R plot since zooming there is a pain and sometimes impossible) What I came up with so far is to use "plot_ly" with scatterrgl type to get started and I could successfully plot 300'000 data points. But that is the limit I can get so far. Above this amount of data the whole R software freezes and exits. The frustrating part is that this can be done easily in MATLAB and with R it seems impossible. Is there any alternative to plot_ly for plotting large data in R?


Solution

  • You might try the dygraph package, working fine here with 500k points:

    library(dygraphs)
    my_data = data.frame(x = 1:500000, y = rnorm(500000))
    dygraph(my_data) %>% dyRangeSelector()
    

    enter image description here