From ba1945d685cfbee0a8cbf3c53a8356eaa9484bc0 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 30 Jun 2020 23:23:19 +0200 Subject: [PATCH] enable flags xdelta, ydelta for gnuplot command --- src/frontend/plotting/gnuplot.c | 11 +++++++++-- src/frontend/plotting/gnuplot.h | 1 + src/frontend/plotting/plotit.c | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/frontend/plotting/gnuplot.c b/src/frontend/plotting/gnuplot.c index d1e6c3371..b3908d7b7 100644 --- a/src/frontend/plotting/gnuplot.c +++ b/src/frontend/plotting/gnuplot.c @@ -50,6 +50,7 @@ quote_gnuplot_string(FILE *stream, char *s) void ft_gnuplot(double *xlims, double *ylims, + double xdel, double ydel, const char *filename, const char *title, const char *xlabel, const char *ylabel, GRIDTYPE gridtype, PLOTTYPE plottype, @@ -228,9 +229,15 @@ void ft_gnuplot(double *xlims, double *ylims, fprintf(file, "set yrange [%e:%e]\n", ylims[0] - extrange, ylims[1] + extrange); } - fprintf(file, "#set xtics 1\n"); + if (xdel > 0.) + fprintf(file, "set xtics %e\n", xdel); + else + fprintf(file, "#set xtics 1\n"); fprintf(file, "#set x2tics 1\n"); - fprintf(file, "#set ytics 1\n"); + if (ydel > 0.) + fprintf(file, "set ytics %e\n", ydel); + else + fprintf(file, "#set ytics 1\n"); fprintf(file, "#set y2tics 1\n"); if (gridlinewidth > 1) diff --git a/src/frontend/plotting/gnuplot.h b/src/frontend/plotting/gnuplot.h index f4ebbabea..16c8676d4 100644 --- a/src/frontend/plotting/gnuplot.h +++ b/src/frontend/plotting/gnuplot.h @@ -7,6 +7,7 @@ #define ngspice_GNUPLOT_H void ft_gnuplot(double *xlims, double *ylims, + double xdel, double del, const char *filename, const char *title, const char *xlabel, const char *ylabel, GRIDTYPE gridtype, PLOTTYPE plottype, diff --git a/src/frontend/plotting/plotit.c b/src/frontend/plotting/plotit.c index 57e284e85..e5073fa56 100644 --- a/src/frontend/plotting/plotit.c +++ b/src/frontend/plotting/plotit.c @@ -1077,7 +1077,10 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname) if (devname && eq(devname, "gnuplot")) { /* Interface to Gnuplot Plot Program */ - ft_gnuplot(xlims, ylims, hcopy, + ft_gnuplot(xlims, ylims, + xdelta ? *xdelta : 0.0, + ydelta ? *ydelta : 0.0, + hcopy, title ? title : vecs->v_plot->pl_title, xlabel ? xlabel : ft_typabbrev(vecs->v_scale->v_type), ylabel ? ylabel : ft_typabbrev(y_type),