Gwyddion – Free SPM (AFM, SNOM/NSOM, STM, MFM, …) data analysis software

GwyGraphBasics

GwyGraphBasics — Common graph functions and utilities

Functions

void gwy_graph_draw_point ()
void gwy_graph_draw_line ()
void gwy_graph_draw_curve ()
void gwy_graph_draw_selection_points ()
void gwy_graph_draw_selection_areas ()
void gwy_graph_draw_selection_lines ()
void gwy_graph_draw_selection_xareas ()
void gwy_graph_draw_selection_yareas ()
void gwy_graph_draw_grid ()
const GwyRGBA * gwy_graph_get_preset_color ()
guint gwy_graph_get_n_preset_colors ()

Types and Values

  GwyGraphActiveAreaSpecs

Includes

#include <libgwydgets/gwydgets.h>

Description

Functions

gwy_graph_draw_point ()

void
gwy_graph_draw_point (GdkDrawable *drawable,
                      GdkGC *gc,
                      gint x,
                      gint y,
                      GwyGraphPointType type,
                      gint size,
                      const GwyRGBA *color);

Draws a point on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

x

X coordinate of the point.

 

y

Y coordinate of the point.

 

type

graph point type

 

size

point size

 

color

point color

 

gwy_graph_draw_line ()

void
gwy_graph_draw_line (GdkDrawable *drawable,
                     GdkGC *gc,
                     gint x_from,
                     gint y_from,
                     gint x_to,
                     gint y_to,
                     GdkLineStyle line_style,
                     gint size,
                     const GwyRGBA *color);

Draws a line segment on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

x_from

x coordinate of the start point of the line

 

y_from

y coordinate of the start point of the line

 

x_to

x coordinate of the end point of the line

 

y_to

y coordinate of the end point of the line

 

line_style

graph line style

 

size

point size

 

color

point color

 

gwy_graph_draw_curve ()

void
gwy_graph_draw_curve (GdkDrawable *drawable,
                      GdkGC *gc,
                      GwyGraphActiveAreaSpecs *specs,
                      GwyGraphCurveModel *gcmodel);

Draws a single graph curve on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

specs

Specifications (boundaries) of the active area of the graph.

 

gcmodel

Curve model of the curve to draw.

 

gwy_graph_draw_selection_points ()

void
gwy_graph_draw_selection_points (GdkDrawable *drawable,
                                 GdkGC *gc,
                                 GwyGraphActiveAreaSpecs *specs,
                                 GwySelectionGraphPoint *selection);

Draws selection points on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context.

 

specs

Specifications (boundaries) of the active area of the graph.

 

selection

A selection of type GwySelectionGraphPoint.

 

gwy_graph_draw_selection_areas ()

void
gwy_graph_draw_selection_areas (GdkDrawable *drawable,
                                GdkGC *gc,
                                GwyGraphActiveAreaSpecs *specs,
                                GwySelectionGraphArea *selection);

Draws selected area on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

specs

Specifications (boundaries) of the active area of the graph.

 

selection

A selection of type GwySelectionGraphArea.

 

gwy_graph_draw_selection_lines ()

void
gwy_graph_draw_selection_lines (GdkDrawable *drawable,
                                GdkGC *gc,
                                GwyGraphActiveAreaSpecs *specs,
                                GwySelectionGraphLine *selection,
                                GtkOrientation orientation);

Draws selected lines on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

specs

Specifications (boundaries) of the active area of the graph.

 

selection

a GwySelectionGraphLine structure

 

orientation

horizontal or vertical orientation

 

gwy_graph_draw_selection_xareas ()

void
gwy_graph_draw_selection_xareas (GdkDrawable *drawable,
                                 GdkGC *gc,
                                 GwyGraphActiveAreaSpecs *specs,
                                 GwySelectionGraph1DArea *selection);

Draws selected x-area on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

specs

Specifications (boundaries) of the active area of the graph.

 

selection

A selection of type GwySelectionGraph1DArea.

 

gwy_graph_draw_selection_yareas ()

void
gwy_graph_draw_selection_yareas (GdkDrawable *drawable,
                                 GdkGC *gc,
                                 GwyGraphActiveAreaSpecs *specs,
                                 GwySelectionGraph1DArea *selection);

Drawss selected y-area on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

specs

Specifications (boundaries) of the active area of the graph.

 

selection

A selection of type GwySelectionGraph1DArea.

 

gwy_graph_draw_grid ()

void
gwy_graph_draw_grid (GdkDrawable *drawable,
                     GdkGC *gc,
                     GwyGraphActiveAreaSpecs *specs,
                     guint nxdata,
                     const gdouble *x_grid_data,
                     guint nydata,
                     const gdouble *y_grid_data);

Draws an array of grid lines on a drawable.

Parameters

drawable

A drawable.

 

gc

Graphics context. It is modified by this function unpredictably.

 

specs

Specifications (boundaries) of the active area of the graph.

 

nxdata

Number of x grid positions.

 

x_grid_data

Array of grid data for the x-axis, it can be NULL if nxdata is zero.

 

nydata

Number of y grid positions.

 

y_grid_data

Array of grid data for the y-axis, it can be NULL if nydata is zero.

 

gwy_graph_get_preset_color ()

const GwyRGBA *
gwy_graph_get_preset_color (guint i);

Gets a preset graph color.

Preset colors are a set of selected colors one can use to distingush graph curves when there is no reason to prefer a particular color. Note they can occasionally change between version, even their number can change.

Parameters

i

Color number, starting from 0 which is always black. It can be any number but colors start to repeat after gwy_graph_get_n_preset_colors() colors.

 

Returns

A constant color that must not be neither modified nor freed.

gwy_graph_get_n_preset_colors ()

guint
gwy_graph_get_n_preset_colors (void);

Gets the number of distinct colors gwy_graph_get_preset_color() can return.

Returns

The number of distinct colors.

Types and Values

GwyGraphActiveAreaSpecs

typedef struct {
    gint xmin;
    gint ymin;
    gint height;
    gint width;
    gdouble real_xmin;
    gdouble real_ymin;
    gdouble real_height;
    gdouble real_width;
    gboolean log_x;
    gboolean log_y;
} GwyGraphActiveAreaSpecs;

Graph area specification (for graph drawing primitives).

Members

gint xmin;

X offset of the active area with respect to drawable left border.

 

gint ymin;

Y offset of the active area with respect to drawable top border.

 

gint height;

Active area height in pixels.

 

gint width;

Active area width pixels.

 

gdouble real_xmin;

Minimum x value in real units.

 

gdouble real_ymin;

Minimum y value in real units.

 

gdouble real_height;

Area height in real units.

 

gdouble real_width;

Area width in real units.

 

gboolean log_x;

TRUE if x-axis is logarithmic.

 

gboolean log_y;

TRUE if y-axis is logarithmic.

 
© David Nečas and Petr Klapetek

Home Download News Features Screenshots Documentation Communicate Participate Resources Publications Applications Site Map

Valid XHTML 1.0 Valid CSS