您可以删除 Plotly Python Scatter3d 中的悬停坐标线吗 [英] Can you remove the hover-coordinate-lines in Plotly Python Scatter3d
本文介绍了您可以删除 Plotly Python Scatter3d 中的悬停坐标线吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当使用 Plotly Scatter3D 时,默认的鼠标悬停效果显示一种坐标十字准线.有没有办法去掉这个效果,只显示工具提示?
When using Plotly Scatter3D , the default mouse hover-over effect displays a kind of coordinate crosshairs. Is there a way to remove this effect and just show the tooltip?
推荐答案
导致线条出现在轴上的悬停效果称为 spikes
在 Plotly 中.您可以通过 layout = {'scene': {'xaxis': {'showspikes': False}}}
禁用它们.
The hover effect causing the lines to show up on the axis are called spikes
in Plotly. You can disable them via layout = {'scene': {'xaxis': {'showspikes': False}}}
.
交互式 Javascript 示例:
Interactive Javascript example:
Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/3d-scatter.csv', function(err, rows) {
function unpack(rows, key) {
return rows.map(function(row) {
return row[key];
});
}
var trace = {
x: unpack(rows, 'x2'),
y: unpack(rows, 'y2'),
z: unpack(rows, 'z2'),
mode: 'markers',
marker: {
color: 'rgb(127, 127, 127)',
size: 12,
symbol: 'circle',
line: {
color: 'rgb(204, 204, 204)',
width: 1
},
opacity: 0.9
},
type: 'scatter3d'
};
var data = [trace];
var layout = {
scene: {
xaxis: {
showspikes: false
},
yaxis: {
showspikes: false
},
zaxis: {
showspikes: false
}
}
};
Plotly.newPlot('myDiv', data, layout);
});
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<div id="myDiv" style="width:100%;height:100%"></div>
这篇关于您可以删除 Plotly Python Scatter3d 中的悬停坐标线吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文