Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#117 Control plotting of specific data points

closed-works-for-me
nobody
None
5
2005-07-29
2005-07-27
k_d_nelson
No

Often you have data points which you know are not valid for some reason and would like to exclude them from a plot. The only way I know of to do this is to edit the data file, but it can be much more difficult to distinguish those points when looking at numbers than when looking at a graph. I propose a way to exclude specific points from within Gnuplot. I imagine a new keyword such as "except" which takes a list of record numbers to exclude, unlike the "every" keyword which can only exclude data at regular intervals.

Then, the feature that would _really_ make this useful would be to have a mouse command that adds points to this list. For example, click the mouse to exclude the point nearest the cursor, or draw a box and exclude all points inside it.

Discussion

  • Ethan Merritt
    Ethan Merritt
    2005-07-27

    Logged In: YES
    user_id=235620

    The example you request is already possible. Please see the
    "mousevariables" demo for an example of how to obtain
    coordinates using the mouse. Let us assume that you have
    used the mouse to obtain the corners of an exclusion
    rectangle X1,Y1,X2,Y2. Then you replot the data excluding
    all points in this region using a command sequence such as:

    exclude(x,y) = (x > X1 && x < X2 && y > Y1 && y < Y2) ? 1 : 0

    plot "data" using ($1) : (exclude($1,$2) ? 1/0 : $2) with
    points

     
  • k_d_nelson
    k_d_nelson
    2005-07-28

    Logged In: YES
    user_id=1122417

    This is very clever, and I thank you for taking the time to
    show how to do it. The only additional thing one might want
    would be multiple excluded areas, or irregularly shaped
    areas. Now that I have read your method, I'll see if I can
    make that work, too.

     
  • Ethan Merritt
    Ethan Merritt
    2005-07-29

    • status: open --> closed-works-for-me
     
  • Ethan Merritt
    Ethan Merritt
    2005-07-29

    Logged In: YES
    user_id=235620

    I'm closing this one, since the basic functionality is
    already present. I think all the fancy variants you mention
    can be handled in a loadable script without requiring any
    new program features.