Sha256: 6455a91f79b253f801414240daaaec460a7afe4fc4d7de0146f8380b6f49bf46

Contents?: true

Size: 710 Bytes

Versions: 6

Compression:

Stored size: 710 Bytes

Contents

#!/usr/bin/env ruby
#
# Created by Paolo Bosetti on 2009-04-27.
# Copyright (c) 2009 University of Trento. All rights 
# reserved.

require "../lib/flotr"

sin = Flotr::Data.new(:label => "Sin(x)", :color => "red")
cos = Flotr::Data.new(:label => "Cos(x)", :color => "blue")

100.times do |i| 
  cos << [i, Math::cos(Math::PI / 100 * i)]
  sin << [i, Math::sin(Math::PI / 100 * i)]
end

plot = Flotr::Plot.new("Test plot")
plot.comment = "This is a test plot made with Flotr"
plot.options = {:legend_position => "ne", :points => 'true'}
plot.height = 480
plot.width = 640
plot.label = {:X => "X"}   # :Y label seems not working on Safari
plot.ylim = {:min=> -1.5, :max => 1.5}
plot << sin
plot << cos
plot.show

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
pbosetti-flotr-1.3.5 examples/sincos.rb
pbosetti-flotr-1.3.6 examples/sincos.rb
pbosetti-flotr-1.3.7 examples/sincos.rb
pbosetti-flotr-1.3.8 examples/sincos.rb
flotr-1.3.9 examples/sincos.rb
flotr-1.3.8 examples/sincos.rb