Creating charts

The MATLAB-like API presently supports the following plot types:
  • annotation
  • bar
  • barh
  • compass
  • contour
  • contourf
  • errorbar
  • feather
  • hist
  • histc
  • line
  • pie
  • polar
  • quiver
  • scatter
  • stairs
  • stem

These commands exactly mimic those of the equivalent standard MATLAB plot calls and accept the same input arguments except that to draw Waterloo graphics the first input to each command should be a reference to a Waterloo "GXGraphicObject" such as the GXGraph instance returned by a call to gxgca or subplot.

Recall that gxgca creates a GXGraph if needed so
myPlot=scatter(gxgca(), 1:10, 1:10);
will create a GXFigure, place a single GXGraph in it and create a scatter plot of the supplied points.

How about joining the data points? One way would be to add a line plot to the graph too. Better in this case, is to add the line to the scatter plot. This can be done because plots are GXGraphicObjects too, so plots can parent other plots.

myPlot2=line(myPlot, [], []);
When a plot is a child of another plot, it can share the xdata and ydata of the parent. Setting those inputs empty ("[]")in the call above does that.

The resulting graph is shown to the right.