fix a plotting bug with xlog axis and ylabels

This commit is contained in:
Holger Vogt 2021-01-15 16:02:30 +01:00
parent 3cd2bb3466
commit 273b0fb4a3
1 changed files with 7 additions and 1 deletions

View File

@ -453,7 +453,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
max = graph->absolute.width - graph->viewportxoff;
/* don't subtract font height from right border of grid */
if (graph->grid.ylabel)
max += graph->fontheight;
max += (int)(1.6 * graph->fontheight);
} else {
graph->viewportxoff = (digits + 5 + mag - mag3) * graph->fontwidth;
/* add height of the vertical text to offset*/
@ -733,7 +733,13 @@ loggrid(GRAPH *graph, double lo, double hi, int type, Axis axis)
if (axis == x_axis) {
margin = graph->viewportxoff;
max = graph->absolute.width - graph->viewportxoff;
/* don't subtract font height from right border of grid */
if (graph->grid.ylabel)
max += (int)(1.6 * graph->fontheight);
} else {
/* add height of the vertical text to offset*/
if (graph->grid.ylabel)
graph->viewportxoff += (int)(1.6 * graph->fontheight);
margin = graph->viewportyoff;
max = graph->absolute.height - graph->viewportyoff;
}