Skip to content

Plotting timeseries data #41

Description

@wvengen

How can timeseries data best be plotted using this gem?

When using

require 'gnuplot'

Gnuplot.open do |gp|
  Gnuplot::Plot.new(gp) do |plot|
    plot.xdata :time
    plot.timefmt '"%s"'
    plot.format 'x "%H:%m"'

    plot.data << Gnuplot::DataSet.new( [[Time.now, Time.now + 60], [1, 2]] ) do |ds|
      ds.with = "linespoints"
      ds.title = "Howdy"
    end
  end
end

the errors I get are:

gnuplot> plot '-' title 'Howdy' with linespoints
                                                ^
         line 0: Need full using spec for x time data


gnuplot> 2015-11-23 18:46:14 +0100 1
         ^
         line 0: invalid command


gnuplot> 2015-11-23 18:47:14 +0100 2
         ^
         line 0: invalid command

Workaround: add ds.using = '1:2' to the dataset.
Would it be better if this gem includes a default using for each dataset?

See also http://stackoverflow.com/a/18121824/2866660

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions