Many functions which produce the display of graphical data accept two optional arguments: one to specify the style of lines and symbols, and one to identify the graphical element for interactive manipulation.
The style defines the color, the line dash pattern (for continuous traces) or the shape (for discrete points) of the data.
There are two different ways to specify the style. The first one, described below, is with a single string. The second one, introduced with Sysquake 5, is with an option structure built with plotset or directly with named arguments; it is more verbose, hence easier to understand, and gives access to more settings, such as line width or marker colors.
The possible values in a style string are given below. Note that the color is ignored on some output devices (such as black and white printers) and the dash pattern is used only on high-resolution devices (such as printers or EPS output). The color code is lowercase for thin lines and uppercase for thicker lines on devices which support it.
|arrow at end||a|
|arrows at beginning and end||A|
Color 'h(rrggbb)' specifies a color by its red, green, and blue components; each of them is given by two hexadecimal digits from 00 (minimum brightness) to ff (maximum brightness). Color 'h(rgb)' specifies each component with a single hexadecimal digit. For example, 'h(339933)' and 'h(393)' both specify the same greenish gray. Like for other colors, an uppercase 'H' means that the line is thick.
Style 's' (stairs) is supported only by the plot, dimpulse, dstep, dlsim, and dinitial functions. It is equivalent to a zero-order hold, i.e. two points are linked with a horizontal segment followed by a vertical segment.
Style 't' (stems) draws for each value a circle like 'o' and a vertical line which connects it to the origin (in 2D plots, y=0 for linear scale or y=1 for logarithmic scale; in 3D plots, z=0). In polar plots, stems connects points to x=y=0.
Style 'f' (fill) fills the shape instead of drawing its contour. Exactly how the shape is filled depends on the underlying graphics architecture; if the contour intersects itself, there may be holes.
Style 'a' adds an arrow at the end of lines drawn by plot, and style 'A' adds arrows to the beginning and the end. The arrow size depends only on the default character size, neither on the line length nor on the plot scale. Its color and thickness are the same as the line's.
Many graphical commands accept data for more than one line. If the style string contains several sequences of styles, the first line borrows its style from the first sequence, the second line, from the second sequence, and so on. If there are not enough styles, they are recycled. A sequence is one or two style specifications, one of them for the color and the other one for the dash pattern or the symbol shape, in any order. Sequences of two specifications are used if possible. Commas may be used to remove ambiguity. Here are some examples:
The first line (from (0,1) to (1,1)) is black and dashed, the second line (from (0,2) to (1,2)) is red and dash-dot, and the third line (from (0,3) to (1,3)) is black and dashed again.
The first line is red, the second line is blue, and the third line is black.
The first and third lines are blue and dashed, and the second line is red and solid.
The first and third lines are dotted, and the second line is gray, solid, and thick.
The second optional argument is the graphic ID. It has two purposes. First, it specifies that the graphic element can be manipulated by the user. When the user clicks in a figure, Sysquake scans all the curves which have a non-negative graphic ID (the default value of all commands is -1, making the graphical object impossible to grasp) and sets _z0, _x0, _y0, _id, and _ix such that they correspond to the nearest element if it is close enough to the mouse coordinates. Second, the argument _id is set to the ID value so that the mousedown, mousedrag, and mouseup handlers can identify the different objects the user can manipulate.
In applications without live interactivity, such as Sysquake Remote, the graphic ID argument is accepted for compatibility reasons, but ignored.
Before any figure can be drawn on the screen, the scale (or equivalently the portion of the plane which is represented on the screen) must be determined. The scale depends on the kind of graphics, and consequently is specified in the draw handler, but can be changed by the user with the zoom and shift commands. What the user specifies has always the priority. If he or she has not specified a new scale, the scale command found in the draw handler is used:
If scale is not used, or if some of the limits are NaN (not an number), a default scale is given by the plot commands themselves. If used, the scale command should always be executed before any plot command, because several of them use the scale to calculate traces only over the visible range or to adjust the density of the calculated points of the traces.
If you need to know the limits of the displayed area in your draw handler, use scale to get them right after setting the default scale, so that you take into account the zoom and shift specified by the user:
scale(optString, [defXMin, defXMax, defYMin, defYMax]); sc = scale; xMin = sc(1); xMax = sc(2); yMin = sc(3); yMax = sc(4);
In addition to the scale ticks displayed along the bounding frame, grids can be added to give visual clues and make easier the interpretation of graphics. X and Y grids are vertical or horizontal lines displayed in the figure background. They can be switched on and off by the user in the Grid menu, or switched on by programs with the plotoption command (they are set off by default). In the example below, both X and Y grids are switched on:
plotoption xgrid plotoption ygrid plot(rand(1,10));
Commands which display grids for special kind of graphics are also available:
|sgrid||plotroots, rlocus (continuous-time)|
|zgrid||plotroots, rlocus (discrete-time)|
They can be used without argument, to let the user choose the level of details: none means the command does not produce any output; basic is the default value and gives a simple, non-obstructive hint (a single line or a circle); and full gives more details. To change by program the default level of details (basic), plotoption is used. In the example below, the grid for the complex plane of the z transform is displayed with full details. Once the figure is displayed, the user is free to reduce the level of details with the Grid menu.
scale('equal', [-2,2,-2,2]); zgrid; plotoption fullgrid; plotroots([1,-1.5,0.8]);