Last active
December 6, 2021 17:46
-
-
Save helgasoft/0ddddb9c77d2e12aaf7fc98c32ddd09f to your computer and use it in GitHub Desktop.
R | ECharts | Display big datasets with scatterGL and cartesian2d (GPU processing)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------ 1) prepare data | |
library(tibble) | |
dim <- 12500 # sample data half-quantity | |
slip <- if (dim %% 2) 0.1 else -0.1 | |
setData <- function(offset) { | |
t <- tibble(x = runif(dim, max=10), | |
y = offset + sin(x) - x * slip * runif(dim)) | |
round(t,3) | |
} | |
# two sets, same data shifted vertically | |
dat <- rbind(setData(0), setData(1)) | |
# ------ 2) show data | |
library(echarty) | |
p <- ec.init(load='3D') |> ec.theme('dark-mushroom') | |
p$x$opts <- list( | |
title = list(text=paste('scatterGL -',nrow(dat),'points + zoom')), | |
xAxis = list(show=TRUE), | |
yAxis = list(show=TRUE), | |
series= list(type= 'scatterGL', data= ec.data(dat, 'dataset', FALSE), | |
symbolSize=3, large=TRUE, | |
itemStyle=list(opacity=0.4, color='cyan') | |
), | |
dataZoom = list(type='inside',start=50) | |
) | |
p | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@docal555, @uzpaka - a solution to the problem.
If you like it, please consider giving a Github star ⭐ to echarty.