Hi,
I have been playing with the concept of trying to generate dynamic
plot names, and I am almost there. I need to know the internal
format of string variables.
Consider the following statements:
(%i1) alias(TITLES,gnuplot_curve_titles);
(%o1) [false]
(%i2) Show_titles('string_list):= block([st_list:
string_list,ns_list:[]],
for i:1 thru length(st_list) do
ns_list: endcons(sconcat("\"",title," ' ",st_list[i]," ' ","\""),
ns_list),
return([TITLES,ns_list])
)$
(%i3) d_1: [TITLES, ["title ' xx ' ", "title ' xy ' "]];
(%o3) [TITLES, [title ' xx ' , title ' xy ' ]]
(%i4) d_2: Show_titles([xx,xy]);
(%o4) [TITLES, ["title ' xx ' ", "title ' xy ' "]]
(%i5) xx: [[1,2],[3,4]];
(%o5) [[1, 2], [3, 4]]
(%i6) xy: [[2,3],[3,5]];
(%o6) [[2, 3], [3, 5]]
(%i7) plot2d([[discrete,xx],[discrete,xy]],d_1);
(%o7)
This produces the plot with the appropriate labels, but
we get an error replacing d_1 by d_2 as follows.
(%i8) plot2d([[discrete,xx],[discrete,xy]],d_2);
gnuplot> plot '-' "title ' xx ' " with lines 3, '-' "title ' xy ' "
with lines 1
^
"/home/maxie/sen/maxout.gnuplot", line 3: invalid expression
If I simply copy the output of the line %o4 and paste in into (%i8)
where d_2 should be, it produces the graph as well.
The difference shows up in the lines %o3 vs. %o4
So, does anyone know how to represent d_1, d_2 so that they produce
the same internal format, and I can plot with (%i8).
TIA,
-sen
--
---------------------------------------------------------------------------
| Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu |
| Mathematics Department | |
| Michigan State University | telephone: 517-355-9684 |
| E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 |
---------------------------------------------------------------------------