GNUPlot Help

This is a discussion on GNUPlot Help within the Tech Board forums, part of the Community Boards category; I am doing a C program that calculates the "closest pair" among the points given in an input file. POINTS.TXT ...

  1. #1
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    277

    GNUPlot Help

    I am doing a C program that calculates the "closest pair" among the points given in an input file.

    POINTS.TXT
    Code:
    2 3
    8 9
    10 7
    4 5
    Now my objective is to plot the points using GNUPlot and draw a line between the closest pair of points. I have succeed in drawing the points but am unable to draw line between two specific points.

    Command I have used to plot the points:-

    Code:
    plot "points.txt"
    I need command to draw line between 2 points please.

  2. #2
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    gnuplot / intro / style

    I suppose you could list the 2 points separate from the others, and plot them with the "lines" or "vectors" style.

    points.txt:
    Code:
    #data
    2 3
    8 9
    10 7
    4 5
    
    
    #note: 2 blank lines separate data sets
    #points to draw lines between
    2 3
    4 5
    then in gnuplot:
    Code:
    plot "points.txt" index 0, "points.txt" index 1 with lines
    Consider this post signed

  3. #3
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    277
    Oh thanks a billion.

    Still 2 more query please.

    1. How to change the color of the line? It is appearing Green in Windows.
    2. How to change the appearance of the points? It is appearing like cross mark in Windows.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by anirban View Post
    Oh thanks a billion.

    Still 2 more query please.

    1. How to change the color of the line? It is appearing Green in Windows.
    2. How to change the appearance of the points? It is appearing like cross mark in Windows.
    So -- crazy I know -- but have you typed "help plot" in gnuplot? The "with" part allows you to change linecolor, pointstyle, pointsize, etc.

  5. #5
    Epy
    Epy is offline
    Hen-teaser Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    880
    A little late, but I'd just like to say that my encounters with GNUPlot have been crappy at best, PLplot is vastly superior, check it out: PLplot Home Page - Main

  6. #6
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    277
    Okay thanks but I need just once to give a demo to my teacher.
    So I am happy with GNUPlot and your nice help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gnuplot and C programming
    By bartleby84 in forum C Programming
    Replies: 6
    Last Post: 04-30-2010, 02:53 PM
  2. gnuplot & C++
    By wolfindark in forum C++ Programming
    Replies: 3
    Last Post: 01-19-2010, 08:03 AM
  3. GNUPLOT: Plotting multiple files.
    By waynex in forum Tech Board
    Replies: 3
    Last Post: 01-18-2008, 05:58 AM
  4. gnuplot question
    By vutek0328 in forum Tech Board
    Replies: 1
    Last Post: 11-09-2006, 05:40 AM
  5. gnuplot
    By siubo in forum C Programming
    Replies: 3
    Last Post: 04-16-2003, 10:31 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21