Let's say we have a 2x4 matrix displayed into a Plotly.js heatmap
(in reality it can be 500x1000):
var data = [{z: [[1, 2, 3, 4], [5, 6, 7, 8]], type: 'heatmap'}];
Plotly.newPlot('myDiv', data, {xaxis: { ticksuffix: " mm" }}, {});
<script src="https://cdn.plot.ly/plotly-2.16.2.min.js"></script>
<div id="myDiv"></div>
How to change the x-axis to a custom range, and keep the plot full width?
For example 0 mm to 321 mm
(unit is millimiter), instead of -0.5mm to 3.5mm
?
PS: since the data can be big (500x1000 pixels), I'd like to avoid to have to insert x, y
values in data
itself, because it would make this object 3 times bigger (and the rendering is slow enough).