是否可以为R中的绘图图中的气泡分配图像而不是颜色?
图形的代码示例如下,我想将国家/地区的标志分配给气泡而不是颜色。
library(plotly)
data <- data.frame( "country" = c("United States"," Indonesia", "Brazil"), "population" = c(329256465,262787403, 208846892) )
plot<- plot_ly(data, x = ~country, y = ~population, type = 'scatter', mode = 'markers', size = ~population, color = ~country, colors = 'Paired',
marker = list(opacity = 0.5, sizemode = 'diameter'),
hoverinfo = 'text',
text = ~paste( country, '<br>Population:', population)) %>%
layout(title = 'Population Dist',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE),
showlegend = FALSE)
plot
从互联网获取的图像示例如下