Skip to content

Commit f19c186

Browse files
committed
For top/left axes side: Account for descender portion (the tail of p, y, g etc.) of the first line of the title as well.
1 parent 59e5402 commit f19c186

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/plots/cartesian/axes.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4097,12 +4097,13 @@ function drawTitle(gd, ax) {
40974097
// With ax._depth the initial drawing baseline is at the outer axis border (where the
40984098
// ticklabels are drawn). Since the title text will be drawn above the baseline,
40994099
// bottom/right axes must be shifted by 1 text line to draw below ticklabels instead of on
4100-
// top of them, whereas for top/left axes, the first line would already be correctly drawn
4101-
// before the ticklabels, but we need an offset for all subsequent lines.
4100+
// top of them, whereas for top/left axes, the first line would be drawn
4101+
// before the ticklabels, but we need an offset for the descender portion of the first line
4102+
// and all subsequent lines.
41024103
if(ax.side === 'bottom' || ax.side === 'right') {
41034104
titleStandoff = ax._depth + ax.title.standoff + fontSize * CAP_SHIFT;
41044105
} else if(ax.side === 'top' || ax.side === 'left') {
4105-
titleStandoff = ax._depth + ax.title.standoff + fontSize * (extraLines * LINE_SPACING);
4106+
titleStandoff = ax._depth + ax.title.standoff + fontSize * (MID_SHIFT + (extraLines * LINE_SPACING));
41064107
}
41074108
} else {
41084109
var isInside = insideTicklabelposition(ax);

0 commit comments

Comments
 (0)