Credits Overview Plotting Styles Commands Terminals

Watchpoints

Support for watchpoints is present only if your copy of gnuplot was built with configuration option --enable-watchpoints. This feature is EXPERIMENTAL [details may change before it appears in a release version].

Syntax:

      plot FOO watch {x|y|z|F(x,y)} = <value>
      plot FOO watch mouse
      set style watchpoints nolabels
      set style watchpoints label <label-properties>
      unset style watchpoints      # return to default style
      show watchpoints    # summarizes all watches from previous plot command

A watchpoint is a target value for the x, y, or z coordinate or for a function f(x,y). Each watchpoint is attached to a single plot within a plot command. Watchpoints are tracked only for styles with lines and with linespoints. Every component line segment of that plot is checked against all watchpoints attached the plot to see whether one or more of the watchpoint targets is satisfied at a point along that line segment. A list of points that satisfy the the target condition ("hits") is accumulated as the plot is drawn.

For example, if there is a watchpoint with a target y=100, each line segment is checked to see if the y coordinates of the two endpoints bracket the target y value. If so then some point [x,y] on the line segment satisfies the target condition y = 100 exactly. This target point is then found by linear interpolation or by iterative bisection.

Watchpoints within a single plot command are numbered successively. More than one watchpoint per plot component may be specified. Example:

     plot DATA using 1:2 smooth cnormal watch y=0.25 watch y=0.5 watch y=0.75

figure_watchpoints

Watchpoint hits for each target in the previous plot command are stored in named arrays WATCH_n. You can also display a summary of all watchpoint hits from the previous plot command; see show watchpoints.

     gnuplot> show watchpoints
     Plot title:     "DATA using 1:2 smooth cnormal"
       Watch 1 target y = 0.25         (1 hits)
               hit 1   x 49.7  y 0.25
       Watch 2 target y = 0.5          (1 hits)
               hit 1   x 63.1  y 0.5
       Watch 3 target y = 0.75         (1 hits)
               hit 1   x 67.8  y 0.75

Smoothing: Line segments are checked as they are drawn. For unsmoothed data plots this means a hit found by interpolation will lie exactly on a line segment connecting two data points. If a data plot is smoothed, hits will lie on a line segment from the smoothed curve. Depending on the quality of the smoothed fit, this may or may not be more accurate than the hit from the unsmoothed data.

Accuracy: If the line segment was generated from a function plot, the exact value of x such that f(x) = y is found by iterative bisection. Otherwise the coordinates [x,y] are approximated by linear interpolation along the line segment.

Subtopics