Purpose¶

Adds an arrow, line, ellipse or rectangle to an existing graph.

Format¶

plotAddShape([myAnnotation, ]which_shape, x_start, y_start, x_end, y_end)
Parameters
• myAnnotation (struct) – Optional argument, an instance of a plotAnnotation structure.

• which_shape (string) –

indicating which shape to create, options include:

• ”ellipse”

• ”rectangle”

• x_start (scalar or Nx1 vector) – the X coordinate for the start of the bounding box for each respective shape.

• y_start (scalar or Nx1 vector) – the Y coordinate for the start of the bounding box for each respective shape.

• x_end (scalar or Nx1 vector) – the X coordinate for the end of the bounding box for each respective shape.

• y_end (scalar or Nx1 vector) – the Y coordinate for the end of the bounding box for each respective shape.

Examples¶

// Draw simple graph
x = rndu(10, 1);
y = rndu(10, 1);
plotScatter(x, y);

// The rectangle will be drawn between
// third and sixth points on the plot
x_start = x[3];
y_start = y[3];
x_end = x[6];
y_end = y[6];

// Shape type will be rectangle
annotation_type = "rectangle";


plotAddShape() will add shapes to existing graphs. It will not create a new graph, however, if one does not already exist.
plotAddShape() is not yet supported for surface plots.