我正在尝试更改plotly中的悬停文本。举个例子,下面是 import plotly.graph_objects as go
fig = go.Figure(go.Scatter(
x = [1,2,3,4,5],
y = [2.02825,1.63728,6.83839,4.8485,4.73463],
hovertemplate =
'<i>Price</i>: $%{y:.2f}'+
'<br><b>X</b>: %{x}<br>'+
我正在构建一个基于R中的ggplot的纯图形,我想要增加悬停框中文本的大小。假设我有一个像这样的散乱点:
library(plotly)
library(ggplot2)
d <- data.frame(a = sample(1:50, 30, T),
b = sample(1:50, 30, T),
col = factor(sample(1:3, 30, T)))
gg <- ggplot() + geom_point(aes(x = a, y = b, color = col), data = d)
p
我的网站上有Plotlyjs气泡图。在悬停时,工具提示显示x、y和text。我想在工具提示中定制一个文本,这个功能可用吗?
示例:
var myPlot = document.getElementById('my-graph');
Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv', function(err, rows){
var YEAR = 2007;
var co
我希望有文字作为标签,以一个巧妙的互动数字和悬停在这些标签上,以获得更多的信息。
但是,不允许我在同一代码行中使用文本标签和悬停文本。我拼命追求文字标签,不想使用一个简单的散点点。
是否有一种方法可以修复下面的代码,这样就可以显示文本标签并悬停文本?
谢谢。
# Load packages
require(ggplot2)
require(plotly)
# Example data
data(iris)
str(iris)
# Create new columns - with more information
iris$Symbol <- c("Se", "V
我想在PLOTLY中的线条图中添加数据点及其相应的标签,这将在悬停时可见。
import plotly.plotly as py
import plotly.graph_objs as go
data = [
go.Scatter(
x = [1,2,3,4,5],
y = [2,1,6,4,4],
text = ["Text A", "Text B", "Text C", "Text D", "Text E"],
hoverinfo = &
我有一张堆叠的条形图。在条形图中的段中,我想添加数字(y值),在悬停时,我希望显示一些不同的信息(不是name或x或y值)。
有可能吗?根据我所看到的,hoverinfo,让我们只复制文本中的值或添加名称。
import plotly
from plotly.graph_objs import Layout, Bar
hoverinformation = ["test", "test2", "test3", "test4"] # this info I would like it on hover
data = []
for i
我一直在使用自定义悬停文本()上的示例来更改我正在处理的条形图中的悬停文本。如果我的条形图只包含一个堆叠的条形图,则不会显示新的悬停文本。示例(在缺少hoverinfo的最后一张图中):
library(plotly)
year <- c(2015,2015,2016,2016)
type <- c('A','B','A','B')
perc <- c(10,90,20,80)
data <- data.frame(year,type,perc)
# Plot all the data ... defa
我知道存在用于跟踪(标记/行)的hovertemplate/悬浮文本/选项,但是对于形状,我找不到这样的东西。在移动形状时,是否有一种方法可以使悬停文本弹出?也许是个解决办法?
示例:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(
x=[1.5, 3],
y=[2.5, 2.5],
text=["Rectangle reference to the plot",
"Rectangle reference to th