Using the Groovy API

Invalid properties and the Groovy API

MATLAB plotting commands are unforgiving if you try to set a property that is not implemented for a specific plot type e.g. if you specify a "FaceColor" for a line plot, MATLAB will throw an error.

Waterloo charts all share a common data model. This means that "FaceColor" is a recognised property even for a line plot and no error will be thrown.

Instead, "FaceColor" will be translated to "Fill" - the Waterloo graphics equivalent property - and the this property of the line plot will be set accordingly. This will have no effect on the appearance of your line plot because the value is not used when rendering lines.

The advantages of this are several-fold:

  • As all plots share a single data model, you will find yourself referring to the documentation much less often
  • A single set of property settings can often be used for all plots that share an ancestor plot. Invalid entries for a specific plot-type will just be ignored.

Note however, that this may give undesired results when "Fill" is a used property for the plot. For a scatter plot, the Fill property represents the color of the marker. Specifying multiple settings for the Fill property using different MATLAB-style property arguments will lead to just one of those settings being used. Note that the Groovy API does not specify which will be used - that is an implementation detail that may change as the code is optimised.