0
我在plot_ly在R.圖形與滑塊過濾其數據繪製
簡單數據幀(c_X,c_Y,c_Z,時間)欲第一圖表時的時間數據幀等於零。
然後,我想要一個滑塊從0到1,當滑塊值爲1時,過濾器會顯示只有time = 1的數據的x,y,z散點圖,並且當滑塊值爲0 ,僅在列時間= 0時過濾數據。
test_x = rnorm(50)
test_y = rnorm(50)
test_z = rnorm(50)
time_0 = rep(0, 50)
df_list_1 = list('c_X' = test_x, 'c_Y' = test_y, 'c_Z' = test_z, 'time' = time_0)
df_1 = as.data.frame(df_list_1)
test_x2 = rnorm(50)
test_y2 = rnorm(50)
test_z2 = rnorm(50)
time_1 = rep(1, 50)
df_list_2 = list('c_X' = test_x2, 'c_Y' = test_y2, 'c_Z' = test_z2, 'time' = time_1)
df_2 = as.data.frame(df_list_2)
df_test = rbind(df_1, df_2)
p_all <- plot_ly(df_test, x = ~c_X, y = ~c_Y, z = ~c_Z)
p_all