Navigation
Synopsis Render and save a figure to a file.
Function
  1. void renderSave(Figure fig, loc file)
  2. void renderSave(Figure fig, int width, int height, loc file)
Description Render figure fig and write it to the location file. Currently we only support writing files in png (.png) format.

If no width and height are given the size of the resulting image will be the minimal size required to view the figure.

If a width and height is given then the image will be at least that size. More precisely if the minimum size of the figure is smaller than the given size then the figure will be resized to fit in the given size. If the minimum size of the figure is greater than the given size then the image will be the minimum size required to view the figure.
Pitfalls
  • Only works inside Eclipse.
  • Some figures have a minimal size of 0, for example: box(ellipse()). No part of the figure has an inherent minimal size greater than zero. When using renderSave without specifying a size on such figures a image of size 0x0 (the minimal size) will be rendered. The solution is then to specify a width and height.

    Figures that do not have minimal size 0 are figures where a part of the figure has an inherent minimal size, such as a text element (the minimal size of the text element is the minimal size required to show it in the given fontSize). For example box(box(text("jada"),grow(1.2)),grow(1.2))
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.