Differences between revisions 1 and 2
Revision 1 as of 2008-02-01 08:18:10
Size: 1146
Editor: e178068083
Comment: Added description of plot snippet
Revision 2 as of 2008-02-01 08:19:54
Size: 1146
Editor: e178068083
Comment: Fixed link to attachment
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
[[attachment|plot1d.gdb]] [[attachment:plot1d.gdb]]

Plotting From GDB

When debugging numerical codes it is often very convenient to plot an array or part of an array of numbers. The user defined commands in plot1d.gdb plot an expression that prints like {x1, ..., xN} using gnuplot. Add the code to your .gdbinit or add source plot1d.gdb to .gdbinit to make the commands available.

There are three commands with increasing number of options:

  • plot1d expr: simply plots the value pairs (1, x1), ..., (N, xN). Example: plot1d psi[0]@100.

  • plot1d_opt expr opt: plot like plot1d but pass opt to the gnuplot plot command. Example: plot1d_opt psi[0]@100 "with lines" to plot with lines (instead of dots).

  • plot1d_opt_range expr opt range: plot like plot1d_opt but set the y-range to range. Example: plot1d_opt_range psi[0]@100 "with lines" "[0:2.5]".

The commands write the following temporary files: __plot1d.dump, __plot1d.dat, __plot1d.gp. Be careful that you do not have files of that name in you working directory, they will be overwritten!


None: PlottingFromGDB (last edited 2008-02-01 08:19:54 by e178068083)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.