我已经写了下面的地方,我有一个在背景中的图像(必要的)和一些数据点:
library(plotly)
library(ggplot2)
library(lorem)
df <- data.frame(
id = 1:50,
value = rnorm(50)
)
# background image (necessary)
image_destination <- "https://i.imgur.com/ojTcMtN.jpeg"
gg <- ggplot(df,
aes(x = id,
y = value,
text = ipsum_words(50, collapse = F)
)
) +
geom_point(color = "red", alpha = 0.5, size = 5) +
theme_bw()
# create plot
pp <- ggplotly(gg,
tooltip = c("text"))
# display plot
plotly::layout(pp,
# tooltip = c("text"),
images = list(
list(
source = image_destination,
xref = "x",
yref = "y",
x = 0,
y = 2,
sizex = 100,
sizey = 4,
sizing = "stretch",
opacity = 1,
layer = "below"
)
))
有没有办法操纵plotly
,使geom_point
、increases和mouse over中的size(例如,从目前的5号增加到10号)?