2017-09-12 17 views
0

parcoordsプロットを使用しているときに、plotlyRに設定すると、非常に奇妙なバグが発生しています。例を使用して例えばR Plotly:教科書内のバグ

は、ここに提供:このプロットでhttps://plot.ly/r/parallel-coordinates-plot/

library(plotly) 

df <- read.csv("https://raw.githubusercontent.com/bcdunbar/datasets/master/iris.csv") 

df %>% 
    plot_ly(type = 'parcoords', 
      line = list(color = ~species_id, 
         colorscale = list(c(0,'red'),c(0.5,'green'),c(1,'blue'))), 
      dimensions = list(
      list(range = c(2,4.5), 
       label = 'Sepal Width', values = ~sepal_width), 
      list(range = c(4,8), 
       constraintrange = c(5,6), 
       label = 'Sepal Length', values = ~sepal_length), 
      list(range = c(0,2.5), 
       label = 'Petal Width', values = ~petal_width), 
      list(range = c(1,7), 
       label = 'Petal Length', values = ~petal_length) 
      ) 
     ) 

結果:

enter image description here

これは全体プロットしたものであるが、私は上の画像をトリミングしていません権利。軸を動かすとデータが点滅し、通常はRStudioがクラッシュします。ここに私のSessionInfoです:

> sessionInfo() 

R version 3.4.1 (2017-06-30) 
Platform: x86_64-w64-mingw32/x64 (64-bit) 
Running under: Windows >= 8 x64 (build 9200) 

Matrix products: default 

locale: 
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252 
[4] LC_NUMERIC=C      LC_TIME=German_Switzerland.1252  

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

loaded via a namespace (and not attached): 
[1] compiler_3.4.1 tools_3.4.1 

plotlyの私のバージョン:

> packageVersion('plotly') 
[1] ‘4.7.1’ 

誰もが同じ問題を経験していますか?これには解決策がありますか?

答えて

2

問題はRstudioのビューアにあります。
コードにoptions(viewer=NULL)を追加することをお勧めします。
RStudioの内部ビューアを無効にし、ブラウザでプロットを開きます。

library(plotly) 

options(viewer=NULL) 

df <- read.csv("https://raw.githubusercontent.com/bcdunbar/datasets/master/iris.csv") 
p <- df %>% 
    plot_ly(type = 'parcoords', 
      line = list(color = ~species_id, 
         colorscale = list(c(0,'red'),c(0.5,'green'),c(1,'blue'))), 
      dimensions = list(
      list(range = c(2,4.5), 
       label = 'Sepal Width', values = ~sepal_width), 
      list(range = c(4,8), 
       constraintrange = c(5,6), 
       label = 'Sepal Length', values = ~sepal_length), 
      list(range = c(0,2.5), 
       label = 'Petal Width', values = ~petal_width), 
      list(range = c(1,7), 
       label = 'Petal Length', values = ~petal_length) 
     ) 
    ) 
print(p) 

enter image description here

+0

私は最近..私はそこにも同様のエラーがあったLinuxマシン上でRStudio切断するためにアクセスを得ました。 'options(viewer = NULL) 'を使うと、どちらの場合でも問題が解決しました。ありがとうございます! – Ratnanil