Satimage Previous
A basic example
Home Documentation SmileLab Scripting Graphic objects The scriptable object model A basic example  
Basic example
Let us plot a curve with three points (-1, 1), (0,0), and (1,1). As stated in the dictionary a curve must belong to a plot view, which in turn must belong to a graphic window. The example proceeds as follows: it first makes the objects, then it loads the data into the curve by setting its xdata and ydata properties, finally it requests Smile to draw the resulting graph.
set w to make new graphic window
set v to make new plot view at w
set c to make new curve at v
set c's xdata to {-1, 0, 1}
set c's ydata to {1, 0, 1}
draw w


Import script
Comments
  • The Import script link imports the script into Smile: it works only if you have installed Smile.
  • An explicit call to draw is required because Smile does not systematically refresh the display. This design feature is intended so that you can manipulate graphs with large amounts of data without wasting CPU time with useless updates.
Copyright ©2008 Paris, Satimage