Variables xbrushwidth and gridwidth (to be set e.g. in

.spiceinit) allow setting separately the linewidths of the
graph (xbrushwidth) and the grid (gridwidth).
This commit is contained in:
Holger Vogt 2017-12-09 12:08:07 +01:00
parent 259515c2f7
commit 3d009fef22
3 changed files with 18 additions and 7 deletions

View File

@ -13,3 +13,7 @@ Postscript plotting uses only a UNICODE subset, namely
ISO-8859-1/ISO-8859-15, that allows extended ascii.
Better looking fonts are now used for labelling the axes.
Variables xbrushwidth and gridlinewidth (to be set e.g. in
.spiceinit) allow setting separately the linewidths of the
graph (xbrushwidth) and the grid (gridlinewidth).

View File

@ -56,7 +56,7 @@ void ft_gnuplot(double *xlims, double *ylims,
FILE *file, *file_data;
struct dvec *v, *scale = NULL;
double xval, yval, prev_xval, extrange;
int i, dir, numVecs, linewidth, err, terminal_type;
int i, dir, numVecs, linewidth, gridlinewidth, err, terminal_type;
bool xlog, ylog, nogrid, markers;
char buf[BSIZE_SP], pointstyle[BSIZE_SP], *text, plotstyle[BSIZE_SP], terminal[BSIZE_SP];
@ -108,9 +108,16 @@ void ft_gnuplot(double *xlims, double *ylims,
}
}
/* get linewidth for plotting the graph from .spiceinit */
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth, 0))
linewidth = 1;
if (linewidth < 1) linewidth = 1;
/* get linewidth for grid from .spiceinit */
if (!cp_getvar("gridwidth", CP_NUM, &gridlinewidth, 0))
gridlinewidth = linewidth;
if (gridlinewidth < 1)
gridlinewidth = 1;
if (!cp_getvar("pointstyle", CP_STRING, pointstyle, sizeof(pointstyle))) {
markers = FALSE;
@ -188,8 +195,8 @@ void ft_gnuplot(double *xlims, double *ylims,
tfree(text);
}
if (!nogrid) {
if (linewidth > 1)
fprintf(file, "set grid lw %d \n" , linewidth);
if (gridlinewidth > 1)
fprintf(file, "set grid lw %d \n" , gridlinewidth);
else
fprintf(file, "set grid\n");
}
@ -223,8 +230,8 @@ void ft_gnuplot(double *xlims, double *ylims,
fprintf(file, "#set ytics 1\n");
fprintf(file, "#set y2tics 1\n");
if (linewidth > 1)
fprintf(file, "set border lw %d\n", linewidth);
if (gridlinewidth > 1)
fprintf(file, "set border lw %d\n", gridlinewidth);
if (plottype == PLOT_COMB) {
strcpy(plotstyle, "boxes");

View File

@ -129,13 +129,13 @@ int PS_Init(void)
}
/* get linewidth information from spinit */
if (!cp_getvar("xbrushwidth", CP_REAL, &linewidth))
if (!cp_getvar("xbrushwidth", CP_REAL, &linewidth, 0))
linewidth = 0;
if (linewidth < 0)
linewidth = 0;
/* get linewidth for grid from spinit */
if (!cp_getvar("gridwidth", CP_REAL, &gridlinewidth))
if (!cp_getvar("gridwidth", CP_REAL, &gridlinewidth, 0))
gridlinewidth = linewidth;
if (gridlinewidth < 0)
gridlinewidth = 0;