在Plotly中的点悬停上显示图像 [英] Displaying image on point hover in Plotly

查看:223
本文介绍了在Plotly中的点悬停上显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您将鼠标悬停在散点图上的某个点上时,可以使用Plotly显示文本字段.当用户将鼠标悬停或单击时,是否可以显示与每个点关联的图像?我主要只是在使用Web界面,但我可以改为从R推送ggplot.

Plotly allows you to display text fields when hovering over a point on a scatterplot. Is it possible to instead display an image associated with each point when the user hovers over or clicks on it? I am mostly just using the web interface, but I could instead push my ggplot from R.

推荐答案

不幸的是,目前尚没有 easy 方法可以在图形上的悬停图形上显示图像.

Unfortunately, there is no easy way to display images on hover on plotly graphs at the moment.

如果您想学习一些JavaScript,plotly的嵌入式API 允许您自定义悬停(以及点击)互动.

If you are willing to learn some javascript, plotly's embed API allows you to customize hover (as well as click) interactivity.

这是自定义悬停互动的示例,其顶部显示了图片图.可以在此处找到javascript源代码.

Here is an example of a custom hover interaction showing images on top of a plotly graph. The javascript source code can be found here.

这篇关于在Plotly中的点悬停上显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆