loadplots - loads and formats saved old style plots
Given a file generated by xsave of by the save menu in graphic window this function returns a data structure containing the context and plot definition.
rec is a typed list with type "SPLOT" . Each of its 2:$ fields contains a graphic instruction definition and its parameters. rec(i)(1) gives the fields names of the i th graphic instruction
txt=string(rec) generates the Scilab instructions which reproduce the plot. To make the necessary functions known, load the loadplots function first. This can be done with the instruction
loadplots;
Warning: The loadplots function is currently available with the graphic files saved under the old graphic mode.
set old_style on // switch to old graphic mode
driver('Rec');xbasc();plot2d([0 1.5 4]) //make a plot
xsave(TMPDIR+'/foo.scg') //save it in a binary file
rec=loadplots(TMPDIR+'/foo.scg'); //get the associated data structure
//here rec($) is the data structure associated with the plot2d instruction
rec($).x //the x vector
rec($).y //the y vector
string(rec) //the scilab instructions producing the same plot
mputl(string(rec),TMPDIR+'/foo.sce') //creates a script file
xbasc();exec(TMPDIR+'/foo.sce',-1) //execute it to re-create the plot
xbasc();
set old_style off // switch nack to new graphic mode