Next: , Previous: Managing Curves, Up: Graphics

13.4 Graphics Options

The g g (calc-graph-grid) command turns the “grid” on and off. It is off by default; tick marks appear only at the edges of the graph. With the grid turned on, dotted lines appear across the graph at each tick mark. Note that this command only changes the setting in *Gnuplot Commands*; to see the effects of the change you must give another g p command.

The g b (calc-graph-border) command turns the border (the box that surrounds the graph) on and off. It is on by default. This command will only work with GNUPLOT 3.0 and later versions.

The g k (calc-graph-key) command turns the “key” on and off. The key is a chart in the corner of the graph that shows the correspondence between curves and line styles. It is off by default, and is only really useful if you have several curves on the same graph.

The g N (calc-graph-num-points) command allows you to select the number of data points in the graph. This only affects curves where neither “x” nor “y” is specified as a vector. Enter a blank line to revert to the default value (initially 15). With no prefix argument, this command affects only the current graph. With a positive prefix argument this command changes or, if you enter a blank line, displays the default number of points used for all graphs created by g a that don't specify the resolution explicitly. With a negative prefix argument, this command changes or displays the default value (initially 5) used for 3D graphs created by g A. Note that a 3D setting of 5 means that a total of ‘5^2 = 25’ points will be computed for the surface.

Data values in the graph of a function are normally computed to a precision of five digits, regardless of the current precision at the time. This is usually more than adequate, but there are cases where it will not be. For example, plotting ‘1 + x’ with ‘x’ in the interval ‘[0 .. 1e-6]’ will round all the data points down to 1.0! Putting the command ‘set precision n’ in the *Gnuplot Commands* buffer will cause the data to be computed at precision n instead of 5. Since this is such a rare case, there is no keystroke-based command to set the precision.

The g h (calc-graph-header) command sets the title for the graph. This will show up centered above the graph. The default title is blank (no title).

The g n (calc-graph-name) command sets the title of an individual curve. Like the other curve-manipulating commands, it affects the most recently added curve, i.e., the last curve on the list in the *Gnuplot Commands* buffer. To set the title of the other curves you must first juggle them to the end of the list with g j, or edit the *Gnuplot Commands* buffer by hand. Curve titles appear in the key; if the key is turned off they are not used.

The g t (calc-graph-title-x) and g T (calc-graph-title-y) commands set the titles on the “x” and “y” axes, respectively. These titles appear next to the tick marks on the left and bottom edges of the graph, respectively. Calc does not have commands to control the tick marks themselves, but you can edit them into the *Gnuplot Commands* buffer if you wish. See the GNUPLOT documentation for details.

The g r (calc-graph-range-x) and g R (calc-graph-range-y) commands set the range of values on the “x” and “y” axes, respectively. You are prompted to enter a suitable range. This should be either a pair of numbers of the form, ‘min:max’, or a blank line to revert to the default behavior of setting the range based on the range of values in the data, or ‘$’ to take the range from the top of the stack. Ranges on the stack can be represented as either interval forms or vectors: ‘[min .. max]’ or ‘[min, max]’.

The g l (calc-graph-log-x) and g L (calc-graph-log-y) commands allow you to set either or both of the axes of the graph to be logarithmic instead of linear.

For 3D plots, g C-t, g C-r, and g C-l (those are letters with the Control key held down) are the corresponding commands for the “z” axis.

The g z (calc-graph-zero-x) and g Z (calc-graph-zero-y) commands control whether a dotted line is drawn to indicate the “x” and/or “y” zero axes. (These are the same dotted lines that would be drawn there anyway if you used g g to turn the “grid” feature on.) Zero-axis lines are on by default, and may be turned off only in GNUPLOT 3.0 and later versions. They are not available for 3D plots.

The g s (calc-graph-line-style) command turns the connecting lines on or off for the most recently added curve, and optionally selects the style of lines to be used for that curve. Plain g s simply toggles the lines on and off. With a numeric prefix argument, g s turns lines on and sets a particular line style. Line style numbers start at one and their meanings vary depending on the output device. GNUPLOT guarantees that there will be at least six different line styles available for any device.

The g S (calc-graph-point-style) command similarly turns the symbols at the data points on or off, or sets the point style. If you turn both lines and points off, the data points will show as tiny dots. If the “y” values being plotted contain error forms and the connecting lines are turned off, then this command will also turn the error bars on or off.

Another way to specify curve styles is with the LineStyles and PointStyles variables. These variables initially have no stored values, but if you store a vector of integers in one of these variables, the g a and g f commands will use those style numbers instead of the defaults for new curves that are added to the graph. An entry should be a positive integer for a specific style, or 0 to let the style be chosen automatically, or -1 to turn off lines or points altogether. If there are more curves than elements in the vector, the last few curves will continue to have the default styles. Of course, you can later use g s and g S to change any of these styles.

For example, '[2 -1 3] <RET> s t LineStyles causes the first curve to have lines in style number 2, the second curve to have no connecting lines, and the third curve to have lines in style 3. Point styles will still be assigned automatically, but you could store another vector in PointStyles to define them, too.