Browse Source

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).
pre-master-46
Holger Vogt 5 years ago
parent
commit
f61ea3aa96
  1. 1
      src/frontend/plotting/graf.c
  2. 26
      src/frontend/plotting/grid.c
  3. 2
      src/include/ngspice/graph.h

1
src/frontend/plotting/graf.c

@ -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");

26
src/frontend/plotting/grid.c

@ -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();
}

2
src/include/ngspice/graph.h

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

Loading…
Cancel
Save