Browse Source

xlabel, ylabel, title: allow composite strings in zoomed windows

pre-master-46
h_vogt 17 years ago
parent
commit
55848d318a
  1. 4
      ChangeLog
  2. 24
      src/frontend/plotting/plotit.c

4
ChangeLog

@ -1,3 +1,7 @@
2009-03-08 Holger Vogt
* plotit.c fcn plotit(): add quotes again for xlabel, ylabel, title
in cline
2009-03-07 Holger Vogt 2009-03-07 Holger Vogt
* inpcom.c fcn inp_fix_for_numparam(): no quotes changed for plot lines within * inpcom.c fcn inp_fix_for_numparam(): no quotes changed for plot lines within
control section, e.g. plot v(2) xlabel 'my input' ylabel 'output' control section, e.g. plot v(2) xlabel 'my input' ylabel 'output'

24
src/frontend/plotting/plotit.c

@ -250,6 +250,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
double tt, mx, my, rad; double tt, mx, my, rad;
wordlist *wwl, *tw; wordlist *wwl, *tw;
char cline[BSIZE_SP], buf[BSIZE_SP], *pname; char cline[BSIZE_SP], buf[BSIZE_SP], *pname;
char *nxlabel = NULL, *nylabel = NULL, *ntitle = NULL;
int newlen; int newlen;
struct dvec *v, *newv_scale; struct dvec *v, *newv_scale;
@ -260,20 +261,37 @@ plotit(wordlist *wl, char *hcopy, char *devname)
bool rtn = FALSE; bool rtn = FALSE;
if (!wl) if (!wl)
goto quit1;
goto quit1;
wl_root = wl; wl_root = wl;
/* First get the command line, without the limits. */
/* First get the command line, without the limits.
Wii be used for zoomed windows */
wwl = wl_copy(wl); wwl = wl_copy(wl);
(void) getlims(wwl, "xl", 2); (void) getlims(wwl, "xl", 2);
(void) getlims(wwl, "xlimit", 2); (void) getlims(wwl, "xlimit", 2);
(void) getlims(wwl, "yl", 2); (void) getlims(wwl, "yl", 2);
(void) getlims(wwl, "ylimit", 2); (void) getlims(wwl, "ylimit", 2);
/* remove tile, xlabel, ylabel */
nxlabel = getword(wwl, "xlabel");
nylabel = getword(wwl, "ylabel");
ntitle = getword(wwl, "title");
pname = wl_flatten(wwl); pname = wl_flatten(wwl);
(void) sprintf(cline, "plot %s", pname); (void) sprintf(cline, "plot %s", pname);
tfree(pname); tfree(pname);
wl_free(wwl); wl_free(wwl);
/* add title, xlabel or ylabel, if available, with quotes '' */
if (nxlabel) {
sprintf(cline, "%s xlabel '%s'", cline, nxlabel);
tfree (nxlabel);
}
if (nylabel) {
sprintf(cline, "%s ylabel '%s'", cline, nylabel);
tfree (nylabel);
}
if (ntitle) {
sprintf(cline, "%s title '%s'", cline, ntitle);
tfree (ntitle);
}
/* Now extract all the parameters. */ /* Now extract all the parameters. */

Loading…
Cancel
Save