1
플로팅 차트와 막대 차트를 중첩하여 (중요한 날짜를 나타내는 수직선으로) 두 개의 제로 라인이 오프셋 된이 문제가 발생했습니다 같은 줄에있는 대신에. 난 내에서 overlaying = 'y'
옵션으로 주위를 망쳐 봤는데 세 trace
구성 요소의 순서를 변경했지만 아무것도 도움이 될 것 같습니다. 어떤 아이디어를 수정하는 방법? 다음은 더미 데이터 내 코드는 다음과 같습니다이중 축 플롯에서 서로 다른 레벨의 제로 라인을 표시합니다.
date <- seq(as.Date("2015/6/1"), by = "month", length.out = 19)
wires_mnth <- c(rep(0,8),100000,750000,1200000,2500000,3100000,5500000,7500000,8000000,9900000,11300000,11000000)
wires_cnt <- c(rep(0,8),100,200,250,325,475,600,750,800,1000,1150,1200)
data <- data.frame(date, wires_mnth)
plot_ly(data) %>%
add_trace(x = ~date, y = ~wires_cnt, type = 'bar', name = 'Wires Count',
yaxis = 'y2', opacity = .5) %>%
add_trace(x = ~date, y = ~wires_mnth, type = 'scatter', mode = 'lines', name
= 'Monthly Wires') %>%
add_trace(x = c(2016,2016), y = c(0, 12000000), type = 'scatter', mode =
"lines", name = 'Sanctions Removed') %>%
layout(title = 'Monthly Aggregate Wire Transfers to Iran',
xaxis = list(title = ''),
yaxis = list(side = 'left', title = 'Wire Amounts (USD)', showgrid =
FALSE, zeroline = FALSE),
yaxis2 = list(side = 'right', overlaying = 'y', title = 'Wires Count',
showgrid = FALSE, zeroline = FALSE)
)
plotly 마법사 ! – rmbaughman