javascript - 绘图.js : Hide Heatmap Axes and Legends

标签 javascript plotly heatmap

使用 Plotly js 制作热图,如何删除 x 轴、y 轴和图例?下面你会找到我的代码

heatmap

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"
    }
  ]

})

最佳答案

只需前往 official plotly documentation 查找显示/隐藏元素的相应属性即可。 。以下属性是您所需要的。

以下是代码,已更改布局属性以满足您的要求。

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"
    }
  ]

})

关于javascript - 绘图.js : Hide Heatmap Axes and Legends,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51661445/

相关文章:

javascript - Web:如何检查音频是否正在播放?

r - 修改 R Plotly 中的单个刻度标签

r - 如何扩展 heatmap.2 中的树状图

python - 如何在 python 中创建从绿色到红色的热图?

javascript - 通过重新加载页面或重新加载脚本/外部资源来修复Web应用程序错误

javascript - 了解 animateSlider.js 中 $.resolve 的用法

r - plotly_build修改图例和标签

python - 如何使用 bootstrap 设计我的 Plotly Dash 应用程序?

r - 如何在 R 热图中为连续颜色条设置特定颜色?

javascript - TypeScript:按顺序发送多个 HTTP 请求 Angular2