title: Animated 3d scatterplot in Ruby with ruby_gnuplot
body: <p>Is it possible to create animated 3 dimensional scatterplots in Ruby using the gnuplot gem?</p>
  
  <p>I've had a look through the gem source code, a bunch of examples, and the gnuplot manual, but haven't managed to figure out what to do.</p>
  
  <p>I'm imagining I'll have to fork it and add some do-loop functionality - but before I do that I was wondering if there was a good way of doing it.</p>
  
  <p>Here's an excerpt from my code showing what I have so far.</p>
  
  <pre><code>Gnuplot.open do |gp|
    Gnuplot::SPlot.new( gp ) do |plot|
      plot.title 'Orbital Simulation'
  
      N.times do | i |
        objects.each { | key, object | object.calc_tick(objects.except key) }
        objects.each { | key, object | object.apply_tick }
  
        x = []
        y = []
        z = []
  
        objects.each do | key, object |
          x &lt;&lt; object.get_x
          y &lt;&lt; object.get_y
          z &lt;&lt; object.get_z
        end
  
        plot.data &lt;&lt; Gnuplot::DataSet.new( [x, y, z] ) do |ds|
          ds.with = "points"
          ds.notitle
        end
      end
    end
  end
  </code></pre>