if 'set nounits' is given, plotting of the units is suppressed

(they may be added manually to the y and x labels for SI conformity).
This commit is contained in:
Holger Vogt 2021-03-07 22:03:04 +01:00
parent 736d42a5b0
commit f61ea3aa96
3 changed files with 17 additions and 12 deletions

View File

@ -135,6 +135,7 @@ int gr_init(double *xlims, double *ylims, /* The size of the screen. */
}
cp_getvar("nolegend", CP_BOOL, &(graph->nolegend), 0);
cp_getvar("nounits", CP_BOOL, &(graph->nounits), 0);
if (!xlims || !ylims) {
internalerror("gr_init: no range specified");

View File

@ -737,11 +737,13 @@ drawlingrid(GRAPH *graph, char *units, int spacing, int nsp, double dst, double
if (nsp == 1)
j += 1000;
}
if (axis == x_axis)
DevDrawText(units, (int) (graph->absolute.width * RELPOSXUNIT + unitshift), graph->fontheight, 0);
else
DevDrawText(units, graph->fontwidth,
(int) (graph->absolute.height - 2 * graph->fontheight), 0);
if (!graph->nounits) {
if (axis == x_axis)
DevDrawText(units, (int)(graph->absolute.width * RELPOSXUNIT + unitshift), graph->fontheight, 0);
else
DevDrawText(units, graph->fontwidth,
(int)(graph->absolute.height - 2 * graph->fontheight), 0);
}
DevUpdate();
}
@ -943,12 +945,14 @@ drawloggrid(GRAPH *graph, char *units, int hmt, int lmt, int decsp, int subs, in
}
}
if (axis == x_axis)
DevDrawText(units, (int) (graph->absolute.width * RELPOSXUNIT + unitshift),
graph->fontheight, 0);
else
DevDrawText(units, graph->fontwidth,
(int) (graph->absolute.height - 2 * graph->fontheight), 0);
if (!graph->nounits) {
if (axis == x_axis)
DevDrawText(units, (int)(graph->absolute.width * RELPOSXUNIT + unitshift),
+graph->fontheight, 0);
else
DevDrawText(units, graph->fontwidth,
(int)(graph->absolute.height - 2 * graph->fontheight), 0);
}
DevUpdate();
}

View File

@ -33,7 +33,7 @@ struct graph {
int currentcolor;
int linestyle;
bool nolegend;
bool nolegend, nounits;
struct {
int height, width;