From: Ethan A M. <me...@uw...> - 2022-09-06 07:02:24
|
This is a project I started a couple of years ago. I think it is now ready for general testing and use, so I have added it to the development branch with a configuration option configure --enable-watchpoints The "help" text is below: 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 Watchpoint hits for each targets 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. Using the current mouse x coordinate as a watch target generates a label that moves along the line of the plot tracking the horizontal position of the mouse. This allows simultaneous readout of the y values of multiple plot lines in the same graph. The appearance of the point indicating the current position and of the label can be modified by `set style watchpoint` and `set style textbox` Example: set style watchpoint labels point pt 6 ps 2 boxstyle 1 set style textbox 1 lw 0.5 opaque plot for [i=1:N] "file.dat" using 1:(column(i)) watch mouse |