2016-08-29 3 views
0
그룹 색상이 지정 될 때 나는 오차 막대 색상을 plotly::plot_ly에서 이상한 선택을 관찰하고

:plotly 오차 막대 플롯 이상한 색상

library("data.table") 
library("plotly") 
dat <- data.table(
    low_diff = c(2, 3, 1) 
    , high_diff = c(3, 4, 1) 
    , point = c(10, 11, 9) 
    , type = LETTERS[1:3] 
) 
plot_ly(data = dat, y = type, x = point, mode = "markers", color = type, 
     error_x = list(type = "data", symmetric = FALSE, 
         array = high_diff, arrayminus = low_diff)) 

enter image description here

는 어떻게 지정할 수있는 각 지점해야 오류 표시 줄과 같은 색을 가지고 있습니까?

+0

@Jota Post as answer? – dww

+0

@Jota 네, 물론, 앞으로 가서 게시하고 받아 들일 것입니다. – mlegge

답변

1

여기에 color = type이있는 경우 원하는 그룹을 얻으려면 group = type으로 전환하십시오.

plot_ly(data = dat, y = type, x = point, mode = "markers", group = type, 
     error_x = list(type = "data", symmetric = FALSE, 
         array = high_diff, arrayminus = low_diff)) 
관련 문제