When plotting arrays of curves, plot lines only in the direction

of (in absolute terms) growing x values.
Example: MOS output characteristics.
In the rare case of plotting versus varying x directions
(e.g. example memristor.sp), one has to add the flag
'retraceplot' to the plot command.
This commit is contained in:
Holger Vogt 2020-02-23 14:27:14 +01:00
parent 14b154f5f3
commit e53632c368
6 changed files with 14 additions and 14 deletions

View File

@ -57,9 +57,9 @@ plot tran1.alli tran2.alli alli title 'Memristor with threshold: Internal Progra
settype impedance xmem.x1 tran1.xmem.x1 tran2.xmem.x1
plot xmem.x1 tran1.xmem.x1 tran2.xmem.x1 title 'Memristor with threshold: resistance'
* resistance versus voltage (change occurs only above threshold!)
plot xmem.x1 vs v(1) tran1.xmem.x1 vs tran1.v(1) tran2.xmem.x1 vs tran2.v(1) title 'Memristor with threshold: resistance'
plot xmem.x1 vs v(1) tran1.xmem.x1 vs tran1.v(1) tran2.xmem.x1 vs tran2.v(1) retraceplot title 'Memristor with threshold: resistance'
* current through resistor for all plots versus voltage
plot i(v1) vs v(1) tran1.i(v1) vs tran1.v(1) tran2.i(v1) vs tran2.v(1) title 'Memristor with threshold: external current loops'
plot i(v1) vs v(1) tran1.i(v1) vs tran1.v(1) tran2.i(v1) vs tran2.v(1) retraceplot title 'Memristor with threshold: external current loops'
.endc
.end

View File

@ -47,11 +47,11 @@ Rmem plus minus r={V(x)}
op
print all
ac lin 101 1 100k
plot v(11)
*plot v(11)
* approx. 100 simulation points
let deltime = stime/100
tran $&deltime $&stime uic
* plot i(v1) vs v(1)
*plot i(v1) vs v(1) retrace
*** you may just stop here ***
* raise the frequency
let newfreq = 1.2/stime
@ -75,9 +75,9 @@ let res2 = tran2.v(1)/(tran2.I(v1) + 1e-16)
settype impedance res res1 res2
plot res vs time res1 vs tran1.time res2 vs tran2.time title 'Memristor with threshold: resistance'
* resistance versus voltage (change occurs only above threshold!)
plot res vs v(1) res1 vs tran1.v(1) res2 vs tran2.v(1) title 'Memristor with threshold: resistance'
plot res vs v(1) res1 vs tran1.v(1) res2 vs tran2.v(1) retraceplot title 'Memristor with threshold: resistance'
* current through resistor for all plots versus voltage
plot i(v1) vs v(1) tran1.i(v1) vs tran1.v(1) tran2.i(v1) vs tran2.v(1) title 'Memristor with threshold: external current loops'
plot i(v1) vs v(1) tran1.i(v1) vs tran1.v(1) tran2.i(v1) vs tran2.v(1) retraceplot title 'Memristor with threshold: external current loops'
.endc
.end

View File

@ -319,7 +319,7 @@ void ft_gnuplot(double *xlims, double *ylims,
(void) fclose(file);
/* Write out the data and setup arrays */
bool mono = (plottype == PLOT_MONOLIN);
bool mono = (plottype != PLOT_RETLIN);
dir = 0;
prev_xval = NAN;
for (i = 0; i < scale->v_length; i++) {

View File

@ -130,7 +130,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
* interpolation.
*/
if ((degree == 1) && (gridsize == 0)) {
bool mono = (currentgraph->plottype == PLOT_MONOLIN);
bool mono = (currentgraph->plottype != PLOT_RETLIN);
dir = 0;
for (i = 0, j = v->v_length; i < j; i++) {
dx = isreal(xs) ? xs->v_realdata[i] :

View File

@ -600,14 +600,14 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
pfound = TRUE;
}
}
if (getflag(wl, "noretraceplot")) {
if (getflag(wl, "retraceplot")) {
if (pfound) {
fprintf(cp_err,
"Warning: too many plot types given. "
"\"noretraceplot\" is ignored.\n");
"\"retraceplot\" is ignored.\n");
}
else {
ptype = PLOT_MONOLIN;
ptype = PLOT_RETLIN;
pfound = TRUE;
}
}
@ -640,8 +640,8 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
if (eq(buf, "linplot")) {
ptype = PLOT_LIN;
}
else if (eq(buf, "noretraceplot")) {
ptype = PLOT_MONOLIN;
else if (eq(buf, "retraceplot")) {
ptype = PLOT_RETLIN;
}
else if (eq(buf, "combplot")) {
ptype = PLOT_COMB;

View File

@ -22,7 +22,7 @@ enum dvec_flags {
/* Plot types. */
typedef enum {
PLOT_LIN, PLOT_COMB, PLOT_POINT, PLOT_MONOLIN
PLOT_LIN, PLOT_COMB, PLOT_POINT, PLOT_RETLIN
} PLOTTYPE;