Navigation
Synopsis Markup of code that generates a figure.
Syntax
  • <figure FileName> RascalCode </figure>
  • <figure FileName WidthxHeight> RascalCode </figure>
Description With figure markup it is possible to execute visualizations and to include their output in the text. FileName is the name of the file to which the visualization will be saved. It can later be inserted as Image. Optionally, Width and Height can be given that define the size of the resulting figure. By default, the minimal size of the figue is used.

Before executing the Rascal code, the following two imports are added automatically:
import vis::Figure;
import vis::Render;
Examples The input:

<figure fig1.png>
render(box(fillColor("red")));
</figure>

will save a red box in file fig1.png and also produce the listing:

render(box(fillColor("red")));
Later this file can be included as image using: ![fig1](fig1.png) with as result: fig1
Pitfalls
  • The last line of the RascalCode should be of the form:
    render(...);
    
  • <figure> and </figure> should occur at the start of a line.
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.