This package implements a high-level, general purpose plotting widget. You can display any set of data (set of points, curve defined by a parametric function, ...). This widget can automatically display them as a curve, along with labelled axis, axis tic marks, legends,...
This is the base class, that provides 2D graphics. Some children provide polar-coordinates and 3D graphics in addition.
It fully supports the drag-and-drop protocol for all of its children, which means that the user can interactively move them in the Gtk_Plot area.
A Gtk_Plot is closely associated with a Gdk_Drawable, on which all the drawings are done. It can be done anywhere within that drawable, its "position" is indicated by a tuple (X, Y), which are two values between 0.0 and 1.0 (from left to right, or from top to bottom). Its size is also given as a ratio other the drawable's size.
Most points in the plot have also this relative coordinates systems, which makes it really easy to handle resizing of a plot window.
See the package Gtk.Extra.Plot_Ps for a way to easily print a Gtk_Plot to a postscript file.
Widget Hierarchy |
|---|
Gtk_Object (see section Package Gtk.Object) \___ Gtk_Widget (see section Package Gtk.Widget) \___ Gtk_Plot (see section Package Gtk.Extra.Plot) |
Signals |
|---|
Types |
|---|
type Gtk_Plot_Line is new Gdk.C_Proxy; | |
|
A simple line drawn on the plot.
| |
type Gtk_Plot_Text is new Gdk.C_Proxy; | |
|
A text that can be displayed anywhere on the plot.
| |
type Plot3D_Function is access function
(Plot : System.Address;
| |
|
| |
type Plot_Angle is
(Angle_0,
Angle_90,
Angle_180,
Angle_270);
| |
|
Valid values for the angles of texts and titles.
| |
type Plot_Axis_Pos is
(Axis_Left,
Axis_Right,
Axis_Top,
Axis_Bottom);
| |
|
Where the axis should be put
| |
type Plot_Border_Style is
(Border_None,
-- No border is drawn
Border_Line,
-- A simple line on each side
Border_Shadow
-- The right and bottom lines are
-- thicker
);
| |
|
Border types used for legends.
| |
type Plot_Error is
(Error_Div_Zero,
Error_Log_Neg);
| |
|
Errors that can be encountered while calculating a graph.
| |
type Plot_Label_Pos is new Integer; | |
|
Position of labels along an axis.
| |
type Plot_Label_Style is
(Label_Float,
Label_Exp,
Label_Pow);
| |
|
The style of labels (floating point, or scientific notation)
| |
type Plot_Orientation is
(Axis_X,
Axis_Y,
Axis_Z);
| |
|
How to reference axis in 3D plots
| |
type Plot_Scale is
(Scale_Linear, Scale_Log10);
| |
|
Type of scale used for each axis of a graph.
| |
type Plot_Ticks_Pos is new Integer; | |
|
The position and orientation of the ticks along an axis.
See the constants below for the possible values.
Note also that not all the values are valid with all types of axis.
|
Subprograms |
|---|
Creating a plot | ||
procedure Gtk_New
(Plot : out Gtk_Plot;
Drawable : in Gdk.Drawable.Gdk_Drawable
:= Gdk.Drawable.Null_Drawable);
| ||
|
Create a new plot, that will be displayed in Drawable. | ||
procedure Gtk_New
(Plot : out Gtk_Plot;
Width : in Gdouble;
Height : in Gdouble;
Drawable : in Gdk.Drawable.Gdk_Drawable
:= Gdk.Drawable.Null_Drawable);
| ||
|
Create a new plot with a specific size.
| ||
function Get_Type return Gtk.Gtk_Type; | ||
|
Return the internal value associated with a Gtk_Plot.
| ||
procedure Set_Drawable (Plot : access Gtk_Plot_Record; Drawable : in Gdk.Drawable.Gdk_Drawable); | ||
|
Modify the drawable on which the graphs are displayed. | ||
function Get_Drawable (Plot : access Gtk_Plot_Record) return Gdk.Drawable.Gdk_Drawable; | ||
|
Return the drawable on which the graphs are plotted.
| ||
procedure Set_Background (Plot : access Gtk_Plot_Record; Background : in Gdk.Color.Gdk_Color); | ||
|
Change the background for the plot. | ||
procedure Paint (Plot : access Gtk_Plot_Record); | ||
|
Force an immediate repaint of the widget in its pixmap. | ||
procedure Refresh (Plot : access Gtk_Plot_Record; Area : in Gdk.Rectangle.Gdk_Rectangle); | ||
|
Copy the plot's pixmap to the screen. | ||
procedure Set_Magnification (Plot : access Gtk_Plot_Record; Magnification : Gdouble); | ||
|
Change the magnification level of the plot. | ||
procedure Draw_Line (Plot : access Gtk_Plot_Record; Line : Gtk_Plot_Line; X1, Y1, X2, Y2 : Gdouble); | ||
|
Draw a line on the plot
| ||
Coordinates and sizes | ||
procedure Get_Position (Plot : access Gtk_Plot_Record; X : out Gdouble; Y : out Gdouble); | ||
|
Return the position of the Plot within its drawable. | ||
procedure Get_Size (Plot : access Gtk_Plot_Record; Width : out Gdouble; Height : out Gdouble); | ||
|
Return the size of the Plot. | ||
function Get_Internal_Allocation (Plot : access Gtk_Plot_Record) return Gtk.Widget.Gtk_Allocation; | ||
|
Return the real position/size of the plot inside its parent container. | ||
procedure Move (Plot : access Gtk_Plot_Record; X : in Gdouble; Y : in Gdouble); | ||
|
Move the plot widget inside its drawable. | ||
procedure Resize (Plot : access Gtk_Plot_Record; Width : in Gdouble; Height : in Gdouble); | ||
|
Resize the widget. | ||
procedure Move_Resize (Plot : access Gtk_Plot_Record; X : in Gdouble; Y : in Gdouble; Width : in Gdouble; Height : in Gdouble); | ||
|
Move and resize the widget in a single operation. | ||
procedure Get_Pixel (Plot : access Gtk_Plot_Record; Xx : in Gdouble; Yy : in Gdouble; X : out Gdouble; Y : out Gdouble); | ||
|
Get the screen coordinate (relative to Plot's parent) of a point. | ||
procedure Clip_Data (Plot : access Gtk_Plot_Record; Clip : Boolean); | ||
|
If Clip is True, any drawing of a Gtk_Plot_Data will be limited to the | ||
procedure Get_Point (Plot : access Gtk_Plot_Record; X : in Gint; Y : in Gint; Xx : out Gdouble; Yy : out Gdouble); | ||
|
Convert from an absolute screen coordinate to a relative one. | ||
procedure Set_Xrange (Plot : access Gtk_Plot_Record; Xmin : in Gdouble := 0.0; Xmax : in Gdouble := 1.0); | ||
|
Set the range of visible points for this plot. | ||
procedure Set_Yrange (Plot : access Gtk_Plot_Record; Ymin : in Gdouble := 0.0; Ymax : in Gdouble := 1.0); | ||
|
Set the range of visible points for this plot. | ||
procedure Set_Range (Plot : access Gtk_Plot_Record; Xmin : in Gdouble := 0.0; Xmax : in Gdouble := 1.0; Ymin : in Gdouble := 0.0; Ymax : in Gdouble := 1.0); | ||
|
Set both ranges at the same time
| ||
procedure Autoscale (Plot : access Gtk_Plot_Record); | ||
|
Calculate automically the appropriate ranges for the plot.
| ||
procedure Get_Xrange (Plot : access Gtk_Plot_Record; Xmin : out Gdouble; Xmax : out Gdouble); | ||
|
Get the current range for the X axis.
| ||
procedure Get_Yrange (Plot : access Gtk_Plot_Record; Ymin : out Gdouble; Ymax : out Gdouble); | ||
|
Get the current range for the X axis.
| ||
procedure Set_Xscale (Plot : access Gtk_Plot_Record; Scale_Type : in Plot_Scale); | ||
|
Set the type of the X axis (logarithmic, linear, ...).
| ||
procedure Set_Yscale (Plot : access Gtk_Plot_Record; Scale_Type : in Plot_Scale); | ||
|
Set the type of the Y axis (logarithmic, linear, ...).
| ||
function Get_Xscale (Plot : access Gtk_Plot_Record) return Plot_Scale; | ||
|
Get the type of the X axis.
| ||
function Get_Yscale (Plot : access Gtk_Plot_Record) return Plot_Scale; | ||
|
Get the type of the Y axis.
| ||
Axis | ||
|
A Gtk_Plot has four axis, one one each of its sides. These axis can | ||
procedure Gtk_New (Axis : out Gtk_Plot_Axis; Orientation : Plot_Orientation); | ||
|
Create a new axis
| ||
function Axis_Get_Type return Gtk_Type; | ||
|
Return the internal value associated with a Gtk_Plot_Axis.
| ||
function Get_Axis (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos) return Gtk_Plot_Axis; | ||
|
Get a pointer to an axis.
| ||
procedure Axis_Set_Visible (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Visible : in Boolean); | ||
|
Indicate whether the axis should be visible or not.
| ||
function Axis_Visible (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos) return Boolean; | ||
|
Return the visibility state of the axis
| ||
procedure Axis_Set_Title (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Title : in String); | ||
|
Modify the title of the axis. | ||
procedure Axis_Show_Title (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos); | ||
|
Show the title associated with the axis.
| ||
procedure Axis_Hide_Title (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos); | ||
|
Hide the title associated with the axis.
| ||
procedure Axis_Move_Title (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Angle : in Plot_Angle; X : in Gdouble; Y : in Gdouble); | ||
|
Modify the position and orientation of the axis' title. | ||
procedure Axis_Justify_Title (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Justification : in Gtk.Enums.Gtk_Justification); | ||
|
Modify the justification for the axis.
| ||
procedure Axis_Set_Attributes (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Line_Width : in Gfloat; Color : in Gdk.Color.Gdk_Color); | ||
|
Modify the attributes of the lines of the axis.
| ||
procedure Axis_Get_Attributes (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Line_Width : out Gfloat; Color : out Gdk.Color.Gdk_Color); | ||
|
Get the attributes of the axis.
| ||
procedure Axis_Set_Ticks (Plot : access Gtk_Plot_Record; Orientation : in Plot_Orientation; Major_Step : in Gdouble; Num_Minor : in Gint); | ||
|
Set up ticks for a specific orientation. | ||
procedure Axis_Set_Major_Ticks (Plot : access Gtk_Plot_Record; Orientation : in Plot_Orientation; Major_Step : in Gdouble); | ||
|
Modify the step for major ticks. | ||
procedure Axis_Set_Minor_Ticks (Plot : access Gtk_Plot_Record; Orientation : in Plot_Orientation; Num_Minor : in Gint); | ||
|
Modify the number of minor ticks between each major one. | ||
procedure Axis_Set_Ticks_Length (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Length : in Gint); | ||
|
Set the length (in pixels) of the big ticks. | ||
procedure Axis_Set_Ticks_Width (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Width : in Gfloat); | ||
|
Set the width (in pixels) of the ticks. | ||
procedure Axis_Show_Ticks (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Major_Mask : in Plot_Ticks_Pos; Minor_Mask : in Plot_Ticks_Pos); | ||
|
Set the style of the ticks.
| ||
procedure Axis_Set_Ticks_Limits (Plot : access Gtk_Plot_Record; Orientation : in Gtk.Enums.Gtk_Orientation; Ticks_Beg : in Gdouble; Ticks_End : in Gdouble); | ||
|
Indicate the area of the axis that should have ticks. | ||
procedure Axis_Unset_Ticks_Limits (Plot : access Gtk_Plot_Record; Orientation : in Plot_Orientation); | ||
|
Cancel the ticks limits set by a previous call to | ||
procedure Axis_Show_Labels (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Labels_Mask : in Plot_Label_Pos); | ||
|
Indicate whether a label should be drawn at each ticks to indicate | ||
procedure Axis_Title_Set_Attributes (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Ps_Font : in String; Height : in Gint; Angle : in Plot_Angle; Foreground : in Gdk.Color.Gdk_Color; Background : in Gdk.Color.Gdk_Color; Transparent : in Boolean; Justification : in Gtk.Enums.Gtk_Justification); | ||
|
Set the attributes to be used for the title of the axis. | ||
procedure Axis_Set_Labels_Attributes (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Ps_Font : in String; Height : in Gint; Angle : in Plot_Angle; Foreground : in Gdk.Color.Gdk_Color; Background : in Gdk.Color.Gdk_Color; Transparent : in Boolean; Justification : in Gtk.Enums.Gtk_Justification); | ||
|
Set the attributes to be used for the ticks labels. | ||
procedure Axis_Set_Labels_Numbers (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Style : in Plot_Label_Style; Precision : in Gint); | ||
|
Set the style of labels. | ||
procedure Axis_Use_Custom_Tick_Labels (Plot : access Gtk_Plot_Record; Axis : in Plot_Axis_Pos; Custom : in Boolean := True); | ||
|
Indicate which kind of labels should be used for major ticks. | ||
procedure Axis_Set_Labels_Suffix (Plot : access Gtk_Plot_Record; Axis : Plot_Axis_Pos; Text : String); | ||
|
Defines a suffix to add after each label on the axis
| ||
procedure Axis_Set_Labels_Prefix (Plot : access Gtk_Plot_Record; Axis : Plot_Axis_Pos; Text : String); | ||
|
Defines a suffix to add before each label on the axis
| ||
function Axis_Get_Labels_Suffix (Plot : access Gtk_Plot_Record; Axis : Plot_Axis_Pos) return String; | ||
|
Return the suffix added to each label.
| ||
function Axis_Get_Labels_Prefix (Plot : access Gtk_Plot_Record; Axis : Plot_Axis_Pos) return String; | ||
|
Return the prefix added to each label.
| ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||
|
A grid can be displayed in the graph. | ||
Grids | ||