Graphics and Handles
The current AUXLAB graphics system is handle-based. Functions such as figure, axes, plot, line, text, delete, and repaint work with runtime graphics handles rather than only with implicit global state.
Current Handle Variables
Two predefined variables expose the currently active graphics objects:
gcf: current figure handlegca: current axes handle
These are pseudo variables, not ordinary user variables. They depend on an installed graphics backend. If the frontend does not provide graphics support, graphics calls can fail with backend-availability errors.
Creating Graphics Objects
Typical graphics setup now looks like this:
h = figure
ax = axes(h)
plot(ax, [1 2 3 4])
repaint(h)
The current engine metadata shows these common calling patterns:
figure([handle_or_pos_or_name])axes([handle_or_pos])plot(x, [y_or_style], [style], [target_handle])line(x, [y], [target_handle])text(x, y, string, [target_handle])
Passing a target handle is the clearest way to control which object receives the drawing operation.
Handle Properties
Graphics handles can expose and accept properties through member-style access. In current auxlab2 code, axes properties such as these are already used:
xlimylim
Example:
h = figure
ax = axes(h)
ax.xlim = [0 10]
ax.ylim = [-1 1]
plot(ax, tone(440, 500))
repaint(h)
The older help system had only partial graphics property documentation. The new canonical set should document verified properties page by page as they are confirmed in the current backend.
Example With Callback-Owned Graphics
The repository already contains a live example in cb1.aux:
function [out,h,ax]=cb1(in)
if in.?index==0
out = []
h=figure
ax = axes(h)
ax.xlim=[0 10]
else
out ++= in.?data
plot(ax, out)
ax.xlim=[0 10]
repaint(h)
end
This shows an important current pattern:
- create the figure and axes on callback index
0 - store returned handles
- update the same graphics objects on later callback calls
Notes
gcfandgcareport the current figure and axes only when the active graphics backend provides those queries.- Graphics behavior now depends on the frontend.
aux_engineregisters the functions, but the runtime semantics come from the installed backend inauxlab2or another host. - For the current pseudo-variable list, see Pseudo Variables.
Current source basis:
aux_engine/src/func/graphics_builtin.cppauxlab2/src/MainWindow.cppauxlab2/cb1.aux