0

I wrote a program in Gnuplot (a .gp file) to read data from a .txt file and plot scatter graph. How to write a program in Ruby env for running the .gp file? Should I put all the files in the same folder as well as the Gnuplot application folder? I'm not sure how to set the right path.

Jawa
  • 2,336
  • 6
  • 34
  • 39
  • What have you tried? What happened when you tried it? Running external executable code from Ruby as a sub-shell is easily done and is well documented here and on the Internet and in books. Open IRB and enter `%x[ls]` and press enter. – the Tin Man Aug 13 '13 at 14:19
  • 1
    I would suggest you look [over here](http://stackoverflow.com/questions/2232/calling-bash-commands-from-ruby) and make the same call to gnuplot you would make by hand. – EarlGrey Aug 13 '13 at 14:24

1 Answers1

0

why don't you try the ruby gem "gnuplot"?
sometimes it is easier to use gnuplot directly, but gem gnuplot has helped me a lot too because i can directly put the data that i want to draw from my ruby program.
i recommend you to have a try gem gnuplot

btw, if i'm not mistaken usually gnuplot read data from .dat file instead of .txt

lutfianasari
  • 375
  • 4
  • 15