0
我已經構建了具有陰影區域的ggplot2對象。不幸的是,當將ggplotly應用於ggplot2對象時,我無法將這些陰影區域顯示出來。陰影區域在陰謀對象中未顯示
library(ggplot2)
library(plotly)
#data
theDataFrame <- data.frame(game = c(1.0, 2.0, 1.0, 2.0), score = c(1:4), season = c("2000","2000","2001","2001"))
dataFrameForShadedAreas <- data.frame(theXmin = c(1.1, 1.5, 1.8), theXmax = c(1.2, 1.6, 1.9), dummyColors = c(4,7,9))
ggplotObj <- ggplot2::ggplot(data = theDataFrame, aes(x = game, y = score, color = season)) +
ggplot2::geom_line() +
ggplot2::geom_rect(data = dataFrameForShadedAreas, inherit.aes = FALSE,
aes(xmin = theXmin, xmax = theXmax, ymin = -Inf, ymax = +Inf),
#group = dummyColors),
fill = 'turquoise3', alpha = 0.2)
(thePlotlyObj <- ggplotly(ggplotObj))
的GGPLOT2對象(陰影區域)低於
我想plotly不具有用於'geom_rect'你們支持,請參見[可用選項= geom_abline(),geom_bar()等](https://plot.ly/ggplot2/ ) – parth