Skip to content
Prev Previous commit
Next Next commit
fixing code to include both end points in n samples for better symmet…
…ry and span
  • Loading branch information
Austin Martin committed Oct 27, 2025
commit 8cb0e825558326a29612e8fd878b9bd5d339c27a
2 changes: 1 addition & 1 deletion src/traces/violin/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function calc(gd, trace) {
// step that well covers the bandwidth and is multiple of span distance
var dist = span[1] - span[0];
var n = Math.ceil(dist / (bandwidth / 3));
var step = dist / n;
var step = (n > 1) ? dist / (n - 1) : 0;

if(!isFinite(step) || !isFinite(n)) {
Lib.error('Something went wrong with computing the violin span');
Expand Down