From 3d009fef22f5dd127919c06be640484d29fa0288 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 9 Dec 2017 12:08:07 +0100 Subject: [PATCH] Variables xbrushwidth and gridwidth (to be set e.g. in .spiceinit) allow setting separately the linewidths of the graph (xbrushwidth) and the grid (gridwidth). --- README.utf8 | 4 ++++ src/frontend/plotting/gnuplot.c | 17 ++++++++++++----- src/frontend/postsc.c | 4 ++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.utf8 b/README.utf8 index ec561aa73..b7adc0bff 100644 --- a/README.utf8 +++ b/README.utf8 @@ -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). diff --git a/src/frontend/plotting/gnuplot.c b/src/frontend/plotting/gnuplot.c index d07c2f310..1e80798f4 100644 --- a/src/frontend/plotting/gnuplot.c +++ b/src/frontend/plotting/gnuplot.c @@ -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"); diff --git a/src/frontend/postsc.c b/src/frontend/postsc.c index 0088a65a4..3cf3c2eb1 100644 --- a/src/frontend/postsc.c +++ b/src/frontend/postsc.c @@ -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;