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

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

问题描述

Plotly 允许您在将鼠标悬停在散点图上的某个点上时显示文本字段.当用户悬停或点击它时,是否可以显示与每个点相关联的图像?我主要只是使用网络界面,但我可以从 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.

推荐答案

不幸的是,目前没有简单的方法可以在悬停时在绘图图表上显示图像.

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

如果你愿意学习一些 javascript,plotly 的 embed 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天全站免登陆