[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnuplot-info-beta
Subject:    Re: [PATCH 1/2] String variables (user-defined)
From:       Dave Denholm <dave.denholm () insignia ! com>
Date:       2002-08-16 10:20:19
[Download RAW message or body]

Ethan Merritt <merritt@u.washington.edu> writes:

> Hi all.
> 
> String variables in gnuplot: Patch 1 of 2
> 
> ->  I see two problems with both of these patches, which is why I
>     chose not to expand variables inside quotes.
>     (1) My string variables are lexically indicated by a leading $
>         but what if someone really wants to use a label or title
>         that includes such a string?   Some sort of escape character
>         would be necessary.

A related impact is for TeX-related terminal drivers - it is common
for labels to be surrounded by $...$  to tell TeX to typeset in maths mode (?)

> help set format

 ...
 For LaTeX users, the format "$%g$" is often desirable.



Also, there is a clash with 'call', which also uses $. But there it is
always a number after the $, rather than a symbol name.



>     (2) The more serious problem. Variable expansion is easily done
>         at the time a command line is parsed.  But what people really
>         want for labels and titles is on-the-fly substitution.
> 	E.g. if you say    
> 		set label 1 "Current fit param a = $a"
> 		fit ...
> 		plot ...
> 		fit ...
> 		plot ...
>         The only way this makes sense is if the substituion for $a
>         is done in the course of each plot command.  But that is much
>         harder than what I have implemented, or at least it would
>         require changing the code in many more places.
>  


ISTR that last time this got discussed, it was suggested that we don't
need to defer the substitution.

It was sufficient to repeat the
 set label 1 "Current fit param a = $a"
after the fit to force re-evaluation of the value. So we always interpolate
immediately.


dd
-- 
dave.denholm@insignia.com          http://www.insignia.com

[[[[ unsubscribe from info-gnuplot-beta via majordomo@dartmouth.edu ]]]]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic