The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Using Ploticus from Ruby

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Michael Neumann

Posts: 66
Nickname: backflash
Registered: May, 2003

Michael Neumann is fallen in Love with Ruby
Using Ploticus from Ruby Posted: Jan 18, 2005 10:09 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Michael Neumann.
Original Post: Using Ploticus from Ruby
Feed Title: Mike's Weblog
Feed URL: http://www.ntecs.de/blog-old/index.rss?cat=ruby&count=7
Feed Description: Blogging about Ruby and other interesting stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Michael Neumann
Latest Posts From Mike's Weblog

Advertisement
Ploticus is a nice tool to generate diagrams. I wrote a nice wrapper in 143 lines of Ruby code, which makes it easy to use. See yourself:
  require 'ploticus'

  pl = Ploticus.new

  pl.data = (0..10).map {|x| [x, x**2]}

  pl.area {|a|
    a.title = "The title of this plot"
    a.xrange = [0,10]
    a.yrange = [0,100]
  }

  pl.xaxis {|a|
    a.stubs = "incremental"
    a.label = "x"
  }

  pl.yaxis {|a|
    a.stubs = "incremental 10"
    a.label = "x^2"
    a.grid = {:color => "blue"}
  }

  pl.lineplot {|a|
    a.xfield = 1    # use first column for x
    a.yfield = 2    # use second column for y
    a.linedetails = {:color => "red"}
  }

  puts pl.plot!

And the result is:

You can download my ruby-ploticus library from: ntecs.de/viewcvs/viewcvs/ruby-ploticus/

A more advanced example with four plots on a page can be found here. The diagram it generates is shown below:

Read: Using Ploticus from Ruby

Topic: But what does “proven” really mean? Previous Topic   Next Topic Topic: We've Reached The Holy Grail Already and We've Only Had This Blogger-Reader Relationship For...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use