Graph Processing

Many of the Gwyddion data processing modules produce graph as an output. Graphs can be exported into text files or further analyzed within Gwyddion by several graph processing modules. These modules can be found in the Graph menu in the Gwyddion main window. Note that the number of graph modules is quite limited now and consists of basic modules for doing things that are very frequent within SPM data analysis. For more analytical tools you can use your favorite graph processing program.

In this section the graph modules present in Gwyddion are briefly presented.

Basic Operations

First of all zooming and data reading functions are available directly in the graph window:

  • Logarithmic axes – horizontal and vertical axes can be switched between linear and logarithmic using the logscale buttons. Switching to logarithmic scale is possible only for positive values (either on abscissa or ordinate).
  • Zoom in and zoom out – after selecting zoom in simply draw the area that should be zoomed by mouse. Zoom out restores the state where all data can be seen.
  • Measure distances – enables user to select several points within the graph and displays their distances and angles between them.

Graph Cut

Graph is a very simple module that cuts graph curves to the selected range (either given numerically or on the graph with mouse) and creates a new graph. If Cut all curves all curves are cut and put to the new graph; otherwise just the one chosen curve.

Graph Level

Graph level is also a simple module that currently performs linear fit of each graph curve and subtracts the fitted linear functions from them.

Graph Align

Graph align shifts the graphs curves horizontally to maximise their mutual correlations, i.e. match common features in the curves. This is useful in particular for comparison of profiles taken in different locations.

Logscale Transform

The graph window controls allow switching between linear and logarithmic axes. However, for the fitting of power-law-like dependencies it is often useful to physically transform the data by taking logarithms of the values. The logscale transform graph function performs such transformation. You can choose which axis to transform (x, y or both), what to do with non-positive values if they occur and the logarithm base. A new graph is then created, with all curves transformed as requested.

Exporting Graph Curves

Graph curve data can be exported to text files using Export Text. The export dialogue allows choosing several style variations that particular other software may find easier to read. Options Export labels, Export units and Export metadata allow adding informational lines before the actual data. This can be very useful for reminding what the file contains, but may cause problems when the file is read in other software.

Option POSIX number format enforces standard machine-readable scientific number format with decimal dot. Otherwise the values are written according to locale settings (office-style software may like that; scientific software generally does not).

The other important option that influences the structure of the entire file is Single merged abscissa. By default individual curves are written to the file sequentially, separated by empty lines. When this checkbox is enabled the curve export writes one multi-column table with data of all curves and a single abscissa in the first column. If the curves are not sampled identically, some rows will of course contain values only for some curves. Exported file with two separated curves can look like

0.1 3.32e6
0.2 3.80e6
0.4 4.15e6

0.0 11.1
0.3 9.66
0.4 9.70

while with single merged abscissa the same data would be saved

0.0 --- 11.1
0.1 3.32e6 ---
0.2 3.80e6 ---
0.3 --- 9.66
0.4 4.15e6 9.70

It is also possible to export a vector (EPS) or bitmap (PNG) rendering of the graph using Export PostScript or Export Bitmap. However, these options are rather rudimentary. Gwyddion is not a dedicated plotting software and if you want nice graphs use one instead – for instance gnuplot or matplotlib.


Graph statistics display summary information about entire graph curves or selected ranges. The dialogue shows two main groups of quantities that are calculated differently.

Simple Parameters are calculated from the set of ordinate values, without any regard to abscissae. This is important to keep in mind when the curve is sampled non-uniformly, i.e. the intervals between abscissae differ, possibly a lot. A part of the curve which is sampled more densely contains relatively more points and thus also influences the result more. The available parameters include elementary characteristics with the same meaning as for two-dimensional data. Several of them also coincide with basic roughness parameters calculated by the Roughness tool.

On the other hand, Integrals are obtained by integration, utilising the trapezoid rule (or a similar approximation). Therefore, longer intervals contribute more to the results. Available quantities include:

Projected length
The length of the selected interval (or the entire abscissa range if no interval is selected).
Developed length
Sum of lengths of linear segments connecting curve points.
Integral of absolute value of the derivative – calculated as the sum of absolute values of ordinate differences.
Average value
Area under the curve divided by the projected length.
Area under curve
The total integral (sum of positive and negative area).
Positive area
Integral of portions of the curve where it is positive.
Negative area
Integral of portions of the curve where it is negative.
Root mean square
Integral of squared values divided by the projected length.

Function Fitting

The curve fitting is designed namely for fitting of statistical functions used in roughness parameters evaluation. Therefore most of the available functions are currently various statistical functions of surfaces with Gaussian or exponential autocorrelation functions. Nevertheless it also offers a handful of common general-purpose functions.

Within the fitting module you can select the area that should be fitted (with mouse or numerically), try some initial parameters, or let the module to guess them, and then fit the data using Marquardt-Levenberg algorithm.

As the result you obtain the fitted curve and the set of its parameters. The fit report can be saved into a file using Save button. Pressing OK button adds the fitted curve to the graph, if this is not desirable, quit the dialog with Cancel.

Curve fitting module dialog

Force-Distance Curve Fitting

The module for fitting of force-distance curves is very similar to the general curve fitting module, it is just specialized for force-distance curves. Currently, the module serves for fitting jump-in part of force-distance curve (representing attractive forces) using different models:

  • van der Waals force between semisphere and half-space
  • van der Waals force between pyramide and half-space
  • van der Waals force between truncated pyramide and half-space
  • van der Waals force between sphere and half-space
  • van der Waals force between two spheres
  • van der Waals force between cone and half-space
  • van der Waals force between cylinder and half-space
  • van der Waals force between paraboloid and half-space

Note that the curve being fitted must be a real force-distance curve, not a displacement-distance or sensor-distance curve. Recalculation of cantilever deflection into force should be done before calling this module.

Also note that for small cantilever spring constants the amount of usable data in attractive region is limited by effect of jumping into contact.

Critical Dimension

Critical dimension module can be used to fit some typical objects that are often found while analyzing profiles extracted from microchips and related surfaces. These objects are located in the graph and their properties are evaluated.

The user interface of this module is practically the same as of the graph fit module.

Critical dimension module dialog.

DOS Spectrum

DOS spectrum module intended to obtain Density-of-States spectra from I-V STM spectroscopy. It calculates

and plots it as graph.

Find Peaks

The most prominent peaks in graph curves can be automatically located with subsample precision. You can specify the number of most prominent peaks as Number of peaks and the function will mark them on the graph. Peak prominence depends on its height, area and distance from other peaks. Usually the function's idea what are the most prominent peaks agrees quite well with human assessment. If you disagree with the choice you can ask for more peaks and ignore those you do not like.

A table of all the peaks is displayed in the left part, sorted according to Order peaks by. Ordering by position means peaks are listed as they are displayed on the graph from left to right. Prominence order means more significant peaks are listed first.

Several basic characteristics are displayed for each peak: position (abscissa) x, height h, area A, and width (or variance) w. The position is calculated by quadratic subpixel refinement of the peak maximum. The remaining quantities depend on how the peak background is defined. Possible choices include Zero meaning peaks base is always considered to be zero, and Bilateral minimum meaning the peak background is a step function passing through the nearest curve minima on the left and right side of the peak.

Screenshot of automated graph peak location for a height distribution plot.