其中 plot.ly json 属性 使悬停在一行上时显示所有悬停数据
Which plot.ly json property enables all hover data to be displayed when hovering over one line
我在 Matlab 中的图形上绘制两条线,并使用 Matlab 库将其转换为 plot.ly
。当我使用 'strip' = false
json 属性 时,它保留了 Matlab 布局。但是,它删除了将鼠标悬停在一行上时获取所有数据的好功能。当 'strip' = false
时,您只会获得与您悬停的行相关的数据。
有谁知道如何使用 'strip' = false
并保留所有悬停?
Matlab
中的示例代码:
X = linspace(0,2*pi,50)';
Y = [cos(X), 0.5*sin(X)];
figure
plot(X,Y)
然后生成两个plot.ly
图:
fig2plotly(gcf, 'strip', 0);
fig2plotly(gcf, 'strip', 1);
这些可以分别在以下位置找到:
注意悬停行为的不同。
当您使用 strip=false
将 matlab 图转换为 Plotly 图时,hovermode
属性默认设置为 closest
,因此它仅显示与悬停时最近曲线相关的数据.要覆盖此行为:
X = linspace(0,2*pi,50);
Y = [cos(X), 0.5*sin(X)];
figure
plot(X,Y)
% Convert the chart..
plotly_fig = fig2plotly(gcf, 'strip', 0)
% Set hovermode to blank (basically disable the attribute)
plotly_fig.layout.hovermode=''
% Send the updated figure to plotly:
resp = plotly(plotly_fig)
url = resp.url
我在 Matlab 中的图形上绘制两条线,并使用 Matlab 库将其转换为 plot.ly
。当我使用 'strip' = false
json 属性 时,它保留了 Matlab 布局。但是,它删除了将鼠标悬停在一行上时获取所有数据的好功能。当 'strip' = false
时,您只会获得与您悬停的行相关的数据。
有谁知道如何使用 'strip' = false
并保留所有悬停?
Matlab
中的示例代码:
X = linspace(0,2*pi,50)';
Y = [cos(X), 0.5*sin(X)];
figure
plot(X,Y)
然后生成两个plot.ly
图:
fig2plotly(gcf, 'strip', 0);
fig2plotly(gcf, 'strip', 1);
这些可以分别在以下位置找到:
注意悬停行为的不同。
当您使用 strip=false
将 matlab 图转换为 Plotly 图时,hovermode
属性默认设置为 closest
,因此它仅显示与悬停时最近曲线相关的数据.要覆盖此行为:
X = linspace(0,2*pi,50);
Y = [cos(X), 0.5*sin(X)];
figure
plot(X,Y)
% Convert the chart..
plotly_fig = fig2plotly(gcf, 'strip', 0)
% Set hovermode to blank (basically disable the attribute)
plotly_fig.layout.hovermode=''
% Send the updated figure to plotly:
resp = plotly(plotly_fig)
url = resp.url