Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 67f0033

Browse files
committed
images: fix subplot linear to pixel position logic
1 parent 2a20e93 commit 67f0033

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/images/draw.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ module.exports = function draw(gd) {
104104
height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h;
105105

106106
// Offsets for anchor positioning
107-
var xOffset = width * anchors.x[d.xanchor].offset + size.l,
108-
yOffset = height * anchors.y[d.yanchor].offset + size.t;
107+
var xOffset = width * anchors.x[d.xanchor].offset,
108+
yOffset = height * anchors.y[d.yanchor].offset;
109109

110110
var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing;
111111

112112
// Final positions
113-
var xPos = (xref ? xref.l2p(d.x) : d.x * size.w) + xOffset,
114-
yPos = (yref ? yref.l2p(d.y) : size.h - d.y * size.h) + yOffset;
113+
var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset,
114+
yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset;
115115

116116

117117
// Construct the proper aspectRatio attribute

0 commit comments

Comments
 (0)