Class Grace.grace_view


class grace_view : ?debug:bool -> ?layout:layout_t -> unit -> object .. end
The fundamental Grace plotting class. new grace_view ~debug:db ~layout:lo () creates a fresh grace viewport. If the optional debug parameter is set to true, all grace commands will be echoed to stderr. The optional layout parameter, with default `Landscape, can be used to set the page dimensions. Each instance of grace_view corresponds to a single Grace (xmgrace) process.

val gp : Grace_proc.grace_process
Low-level Grace process object.
val mutable auto_redraw : bool
If auto_redraw = true, all drawing operations will automatically update the xmgrace window. auto_redraw is false by default; use set_auto_redraw to change it.

Methods for Controlling Grace Directly

method exec : string -> unit
gv#exec s sends s as a raw command string to the xmgrace process associated with grace_view gv. The string should not be newline terminated. This method may be used to execute arbitrary Grace scripting commands.

Methods for Creating and Formatting 2D Plots

method plot : ?num:int ->
?stem:bool ->
?linestyle:int ->
?linewidth:float ->
?symbol:int ->
?symbolsize:float ->
?logx:bool ->
?logy:bool -> ?grid:grid_t -> float array -> float array -> unit
gv#plot x y plots an array of y values against an array of x values, using the xmgrace viewport associated with grace_view gv. The arrays must have equal length.

Optional arguments: num can be used to specify a desired graph number; if unspecified, the current graph is used. stem, which has default false, can be used to create a stemplot. linestyle, which has default 1, can be used to set the linestyle applied to this dataset. linewidth can be used to set the width of the line drawn through the dataset; if unspecified, the grace default is used. symbol can be used to set the symbol used to render the dataset; it has default 1 for a stemplot and 0 otherwise. symbolsize, which has default 0.5, can be used to set the size of the symbols. logx and logy can be used to provide logarithmic scales; both are false by default. grid, which has default `None, may be used to draw a grid on the plot.

method plot_many : ?num:int ->
?stem:bool ->
?linestyle:linestyle_t ->
?linewidth:float ->
?symbol:symbol_t ->
?symbolsize:float ->
?logx:bool ->
?logy:bool ->
?grid:grid_t ->
?legend:string array ->
?legendfont:int ->
?legendfontsize:float ->
?iter:(int -> unit) -> float array array -> float array array -> unit
gv#plot_many x y plots each of the rows of y vs. the corresponding row of x on a single graph, using the xmgrace viewport associated with grace_view gv. x and y must have the same number of rows, and the nth row of x must have the same length as the nth row of y.

Optional arguments: num can be used to specify a desired graph number; if unspecified, the current graph is used. stem, which has default false, can be used to create a stemplot. linestyle, with default `Auto, can be used to configure the linestyles applied to each dataset. linewidth can be used to set the widths of the lines drawn through the each dataset; if unspecified, the grace default is used. symbol, which has default `None, can be used to set the symbols used to render each dataset. symbolsize, which has default 0.5, can be used to set the size of the symbols. logx and logy can be used to provide logarithmic scales; both are false by default. grid, which has default `None, may be used draw a grid on the plot. A legend can be provided by setting legend to an array containing text for each dataset; the legend font and character size can be set using legendfont and legendfontsize. Finally, the optional user-defined function iter will be executed once for each dataset, and will receive the set index as an argument. This may be useful for sending set-dependent formatting commands via gv#exec.

method axes : ?num:int ->
?xmin:float ->
?xmax:float ->
?ymin:float ->
?ymax:float -> ?xtick:tick_t -> ?ytick:tick_t -> unit -> unit
gv#axes ~num:n ~xmin:x1 ~xmax:x2 ~ymin:y1 ~ymax:y2 ~xtick:xt ~ytick:yt () sets the boundaries and tick marks of a graph's axes, on the xmgrace viewport associated with grace_view gv. All arguments are optional: omitting num will set axes for the current graph, and omitting any of the other parameters will leave the associated setting unchanged.
method label : ?num:int -> ?font:int -> ?size:float -> label_t -> string -> unit
gv#label lt t sets the label of type lt to the text t for a graph belonging to the viewport associated with grace_view gv.

The optional num argument may be used to specify a desired graph number; if unspecified, the current graph is used. The optional font and size arguments may be used to set the desired font number and character size; if unspecified, the Grace defaults are used.

method multiplot : ?rows:int ->
?cols:int -> ?offset:float -> ?hgap:float -> ?vgap:float -> unit -> unit
gv#multiplot ~rows:r ~cols:c ~offset:o ~hgap:h ~vgap:v () rearranges the viewport associated with grace_view gv, into a table with r rows and c columns. The plot will be offset from the page borders by amount o. The horizontal gap h and vertical gap v set the spacing between individual graphs. All arguments are optional; omitting an argument will leave the associated setting unchanged.

Methods for Rendering Existing Plots

method redraw : unit -> unit
gv#redraw () causes the xmgrace process associated with grace_view gv to render its viewport. This method must be called to cause any output to be drawn, unless auto_redraw = true.
method set_auto_redraw : bool -> unit
gv#set_auto_redraw tf sets the value of auto_redraw to tf for grace_view gv. If tf = true, this will cause all drawing operations to automatically update the xmgrace window.

Methods for Sending Output to a File

method print : ?driver:driver_t -> unit -> unit
gv#print () prints to the default output device driver. The optional argument ~driver, with default `PS "untitled.ps", may be used to choose a different driver and target filename.