require 'spice_rub' require 'gnuplotrb' SpiceRub::KernelPool.instance.load_folder("spec/data/kernels") moon = SpiceRub::Body.new(:moon) moon_orbit = 86400 * 27 start = SpiceRub::Time.parse("22 Aug 2016") times = SpiceRub::Time.time_series(start, start + moon_orbit, step: 3600) distances = times.map { |t| moon.distance_from(earth, t) } GnuplotRB::Plot.new( [[times.map(&:et), distances], notitle: true] ,title: 'Distance of Moon from Earth v/s Time', with: 'lines')