我观察到,在提供重复的ticklabels(目的是提及分类变量的类别)时,绘制创建一个唯一的集合并仅显示非重复的刻度标签。有没有办法绕过这个功能并允许重复的刻度标签?
var data = [
{
z: [[1, 20, 30, 50, 1], [20, 1, 60, 80, 30], [30, 60, 1, -10, 20]],
x: ['Healthy', 'Healthy', 'Moderate', 'Diseased', 'Diseased'],
y: ['Morning', 'Afternoon', 'Evening'],
type: 'heatmap'
}
];
Plotly.newPlot('myDiv', data);
以下是描述问题的jsfiddle:
答案 0 :(得分:1)
使用DATE COD QTA
2014-01-02 87 11
2014-01-03 87 0
2014-01-04 87 0
2014-01-05 87 5
2014-01-06 87 0
... 87 ...
Sys.Date() 87 x
2015-02-03 45 3
2015-02-04 45 0
2015-02-05 45 0
... 45 ...
Sys.Date() 45 x
:
ticktext
以下是演示:
var layout = {
xaxis: {
tickmode: "array",
ticktext: ['Healthy', 'Healthy', 'Moderate', 'Diseased', 'Diseased'],
tickvals: [0, 1, 2, 3, 4]
}
}
var data = [{
z: [
[1, 20, 30, 50, 1],
[20, 1, 60, 80, 30],
[30, 60, 1, -10, 20]
],
y: ['Morning', 'Afternoon', 'Evening'],
type: 'heatmap'
}];
var layout = {
xaxis: {
tickmode: "array",
ticktext: ['Healthy', 'Healthy', 'Moderate', 'Diseased', 'Diseased'],
tickvals: [0, 1, 2, 3, 4]
}
}
Plotly.newPlot('myDiv', data, layout);