使用Plotly js作为热图,如何删除x轴,y轴和图例?在下面,您将找到我的代码
var data = [
{
z: z,
type: 'heatmap',
colorscale : [[0, 'rgb(0,0,255)']],
opacity: 1
}
];
Plotly.plot('myDiv', data, {
images: [
{
"source": "../images/img.png",
"xref": "x",
"yref": "y",
"x": -1,
"y": 50,
"sizex": 51,
"sizey": 51,
"sizing": "stretch",
"opacity": 1,
"layer": "above"
}
]
})
答案 0 :(得分:0)
只需转到official plotly documentation,即可查找showing/hiding
元素的相应属性。以下是您需要的属性。
Show Legend-隐藏/显示图例。
X-Axis Visible-隐藏/显示X轴。
Y-Axis Visible-隐藏/显示Y轴。
下面是代码,更改了布局属性以适合您的要求。
var data = [
{
z: z,
type: 'heatmap',
colorscale : [[0, 'rgb(0,0,255)']],
opacity: 1
}
];
Plotly.plot('myDiv', data, {
showlegend: false,
xaxis: {visible: false},
yaxis: {visible: false},
images: [
{
"source": "../images/img.png",
"xref": "x",
"yref": "y",
"x": -1,
"y": 50,
"sizex": 51,
"sizey": 51,
"sizing": "stretch",
"opacity": 1,
"layer": "above"
}
]
})