Graphing 2Ds in Python is pretty easy...

Discussion in 'Ruby' started by Todd Gardner, Jun 10, 2004.

  1. Todd Gardner

    Todd Gardner Guest

    Hello everyone,

    Are there any suggestions about tools I could use to plot a two-dimensional array?

    Thank you,

    Todd
     
    Todd Gardner, Jun 10, 2004
    #1
    1. Advertisements

  2. il 10 Jun 2004 03:47:40 -0700, (Todd Gardner) ha
    scritto::
    plot an array in which way?
    I'm visualizing an histogram as a 'wto dimensional array', but
    probably I'm just dumb and can't see what you mean :)

    Have you looked at RMagick and SVG::Graph ?
     
    gabriele renzi, Jun 10, 2004
    #2
    1. Advertisements

  3. Todd Gardner

    Sean Russell Guest

    Sean Russell, Jun 10, 2004
    #3
  4. Hello!

    If you are looking for a complete scientific framework you
    may want to have a look at ROOT:

    http://root.cern.ch

    It has Python and Ruby bindings. I have done the latter.

    Regards,
     
    Elias Athanasopoulos, Jun 10, 2004
    #4
  5. Todd Gardner

    Armin Roehrl Guest

    R might be another option.
    www.r-project.org
    Use a pipe or the R-ruby bindings.

    Good luck,
    -Armin.
     
    Armin Roehrl, Jun 10, 2004
    #5
  6. Gnuplot is nice, too. The latest version has 3d plotting with
    interactive rotation, zoom, etc.
     
    Joel VanderWerf, Jun 10, 2004
    #6
  7. Todd Gardner

    Todd Gardner Guest

    Hello Armin,

    Thanks for RMagick suggestion. It looks very useful. I am getting
    some errors trying to use it however.

    After successfully installing in on my Windows 2000 machine, I type
    the following:
    require 'RMagick'

    And, I get the output:
    c:/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.5.0-mswin32/lib/RMagick.rb:5:
    uninitialized constant Magick (NameError)
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:54:in `require'
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:54:in `require_gem'
    from c:/ruby/lib/ruby/site_ruby/1.8/RMagick.rb:11
    from 010.rbw:1:in `require'
    from 010.rbw:1
    The line that the error refers to is:
    images = Magick::ImageList.new("images/Button_A.gif",
    "images/Button_B.gif", "images/Button_C.gif")

    Any suggestions how I can fix this?

    Thank you again!

    Todd
     
    Todd Gardner, Jun 11, 2004
    #7
  8. Todd Gardner

    Todd Gardner Guest

    I am using Windows 2000... :~(
     
    Todd Gardner, Jun 11, 2004
    #8
  9. Todd Gardner

    Todd Gardner Guest

    Todd,

    I don't understand why this is happening. What script are you running?
    Is it one of the RMagick sample programs? Can you get any script that
    uses RMagick to work? Try this simple test - does it work?

    ruby -r RMagick -e'p Magick::Long_version'

    ===========

    Tim,

    I get an identical error. I can't run any script that uses (require
    'RMagick'), however it said that it installed 1.5 O.K. I am using
    Windows 2000 :(

    Todd
     
    Todd Gardner, Jun 11, 2004
    #9
  10. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1


    | Tim,
    |
    | I get an identical error. I can't run any script that uses (require
    | 'RMagick'), however it said that it installed 1.5 O.K. I am using
    | Windows 2000 :(
    |
    | Todd

    Allow me to barge in... The 1.5.0 binary gem release is quite new and
    you might actually be the first trying to really put it to use on a
    windows 2k machine.

    Can you verify the following:
    a) Can you
    ~ require 'rubygems'
    ~ require_gem 'RMagick'
    ~ from irb ?
    b) Does your gem installation look ok ? RMagick.so and RMagick.rb there,
    another RMagick.rb in your site_ruby path ?

    Your error looks like the shared object is not loaded at all. If you
    hang in there, I would like to help you get this running.

    - --
    kaspar

    semantics & semiotics
    code manufacture

    www.tua.ch/ruby
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (MingW32)
    Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

    iD8DBQFAygoaFifl4CA0ImQRAhRjAJ4tUqWTs9LsU7ZFtZIH2FwBDBqZvQCdFr1h
    thFPahze0vPvth0VycdXGIo=
    =syTX
    -----END PGP SIGNATURE-----
     
    Kaspar Schiess, Jun 11, 2004
    #10
  11. Todd Gardner

    Todd Gardner Guest

    Kaspar,

    I am quite the novice to ruby however, I'm willing to try to get this
    code running. I have no idea what might be important so I have just
    copy a bunch of things into here. Story for the multitude.

    Let me tell you what I believe I have done up to this point.

    =============================================
    I installed:
    ruby181-13.exe

    =============================================
    I had previously installed:
    Python-2.3.2-1.exe

    =============================================
    I typed:
    gem --install-stub -i RMagick-win32-1.5.0-mswin32.gem

    Which returned:
    Attempting local installation of 'RMagick-win32-1.5.0-mswin32.gem'
    Successfully installed RMagick-win32 version 1.5.0

    =============================================
    =================================================
    from SciTE

    irb(main):001:0> require 'rubygems'
    => true
    irb(main):002:0> require_gem 'RMagick'
    NameError: uninitialized constant Magick
    from c:/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.5.0-mswin32/lib/RMag
    ick.rb:5
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:54:in
    `require'
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:54:in
    `require_gem'
    from (irb):2
    irb(main):003:0> exit

    ==============================================
    When press F5 from SciTE Version 1.59:
    E:\Documents and Settings\tnt\ruby\Ruby Gems\rubygems-0.6.1\install.rb

    I get back:
    ruby install.rb
    Successfully built RubyGem
    Name: sources
    Version: 0.0.1
    File: sources-0.0.1.gem
    Successfully installed sources version 0.0.1
    =============================================
    When I type into the MS-DOS promt:
    gem --local --info progressbar

    I see:
    --- !ruby/object:Gem::Specification
    rubygems_version: "0.6"
    name: progressbar
    version: !ruby/object:Gem::Version
    version: 0.0.3
    date: 2004-06-12 00:53:20.171000 -07:00
    platform:
    summary: "Ruby/ProgressBar is a text progress bar library for Ruby.
    It can indicate progress with percentage, a progress bar, and
    estimated remaining time."
    require_paths:
    - lib
    files:
    - sample/test.rb
    - lib/progressbar.rb
    - docs/progressbar.en.rd
    - docs/progressbar.ja.rd
    - ChangeLog
    autorequire: progressbar
    author: Satoru Takabayashi
    required_ruby_version: !ruby/object:Gem::Version::Requirement
    requirements:
    -
    - ">"
    - !ruby/object:Gem::Version
    version: 0.0.0
    email:
    homepage: http://namazu.org/~satoru/ruby-progressbar/

    ==========================================
    RMagick.so
    C:\ruby\lib\ruby\gems\1.8\gems\RMagick-win32-1.5.0-mswin32\lib
    3.04 MB

    RMagick.rb
    C:\ruby\lib\ruby\site_ruby\1.8
    288 bytes

    - and -

    RMagick.rb
    C:\ruby\lib\ruby\gems\1.8\gems\RMagick-win32-1.5.0-mswin32\lib
    434 bytes

    ===============================================================
    RubyGems Documentation Index
    Gem Name Description Documentation

    progressbar-0.0.3 Ruby/ProgressBar is a text progress bar library for
    Ruby. It can indicate progress with percentage, a progress bar, and
    estimated remaining time. None installed

    RMagick-win32-1.5.0-mswin32 RMagick is an interface between the Ruby
    programming language and the ImageMagick and GraphicsMagick image
    processing libraries. None installed

    sources-0.0.1 This package provides download sources for remote gem
    installation None installed

    =============================================
    gem --alien

    Performing the 'alien' operation
    Checking gem database for inconsistencies
    c:/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.5.0-mswin32
    c:/ruby/lib/ruby/gems/1.8/gems/sources-0.0.1
    c:/ruby/lib/ruby/gems/1.8/gems/progressbar-0.0.3
    RMagick-win32-1.5.0-mswin32 has 2 problems
    config/type-windows.mgk:
    installed file doesn't match original from gem

    lib/RMagick.rb:
    installed file doesn't match original from gem


    sources-0.0.1 has 2 problems
    c:/ruby/lib/ruby/gems/1.8/cache/sources-0.0.1.gem:
    Invalid checksum for Gem file

    c:/ruby/lib/ruby/gems/1.8/cache/sources-0.0.1.gem:
    Unmanaged files in gem: ["lib/sources.rb"]


    progressbar-0.0.3 has 2 problems
    c:/ruby/lib/ruby/gems/1.8/cache/progressbar-0.0.3.gem:
    Invalid checksum for Gem file

    c:/ruby/lib/ruby/gems/1.8/cache/progressbar-0.0.3.gem:
    Unmanaged files in gem: ["sample/test.rb", "lib/progressbar.rb",
    "docs/progressbar.ja.rd", "docs/progressbar.en.rd", "ChangeLog"]

    ==========================================================
    gem --rubygems-info

    RubyGems:
    - VERSION: 0.6
    - INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
    - GEM PATH:
    - c:/ruby/lib/ruby/gems/1.8
    - REMOTE SOURCES:
    - http://gems.rubyforge.org
    ==========================================================
    I would be glad to test whatever I can.
    Please let me know you have any questions.

    Thanks in advance for any suggestions.

    Todd
     
    Todd Gardner, Jun 12, 2004
    #11
  12. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hello Todd,

    type-windows.mgk and RMagick.rb don't match the original files from the
    gem. The first mismatch is ok, that file gets modified on your system
    with your Font files (in postinstall procedure). The second mismatch is
    weird; Could you send that file to my private adress ? I will have a
    look at how it mismatches.

    Have you executed postinstall ? You did not mention that.

    Otherwise I am still puzzled..

    kaspar

    semantics & semiotics
    code manufacture

    www.tua.ch/ruby
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (MingW32)
    Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

    iD8DBQFAyyeoFifl4CA0ImQRAhN9AKCCR9vpXuu7cDm4BnU3VxYDg8pywQCfSMa8
    rBfmmPio9DBRcOivT0IEc/o=
    =m99L
    -----END PGP SIGNATURE-----
     
    Kaspar Schiess, Jun 12, 2004
    #12
  13. Todd Gardner

    Todd Gardner Guest

    Hello Todd,
    I did execute postintall.rb. Sorry for not mentioning that.

    The result was:
    RMagick 1.5.0 win32 Post Installation (see enclosed README for license
    information)
    detecting available fonts, writing to config/type-windows.mgk...ok.
    setting MAGICK_CONFIGURE_PATH to
    'c:/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.5.0-mswin32/config'.
    setting is only for current user.
    all done.
    I'll send you RMagick.rb to your private address soon.
     
    Todd Gardner, Jun 12, 2004
    #13
  14. Todd Gardner

    Todd Gardner Guest

    When I type and names of the files you mentioned I get the following output.

    irb(main):001:0> type-windows.mgk
    (irb):1: warning: Object#type is deprecated; use Object#class
    NameError: undefined local variable or method `windows' for main:Object
    from (irb):1
    irb(main):002:0> RMagick.rb
    NameError: uninitialized constant RMagick
    from (irb):2
     
    Todd Gardner, Jun 12, 2004
    #14
  15. Todd Gardner

    Todd Gardner Guest

    Hello Kaspar,

    C:\ruby>cd lib\ruby\gems\1.8\gems\RMagick-win32-1.5.0-mswin32\lib
    C:\ruby\lib\ruby\gems\1.8\gems\RMagick-win32-1.5.0-mswin32\lib>dir

    Directory of C:\ruby\lib\ruby\gems\1.8\gems\RMagick-win32-1.5.0-mswin32\lib

    06/11/2004 01:57a <DIR> .
    06/11/2004 01:57a <DIR> ..
    06/12/2004 01:42a 45,079 RMagick.rb
    06/12/2004 01:42a 3,193,856 RMagick.so
    2 File(s) 3,238,935 bytes
    2 Dir(s) 6,216,265,728 bytes free

    C:\ruby\lib\ruby\gems\1.8\gems\RMagick-win32-1.5.0-mswin32\lib>irb
    irb(main):001:0> require 'RMagick.rb'
    => true
    irb(main):002:0> require 'RMagick.so'
    => false

    Todd
     
    Todd Gardner, Jun 14, 2004
    #15
  16. Todd Gardner

    Todd Gardner Guest

    I am using Windows 2000... :~( I have looked through this site
    however I can't figure out how to use SVG::Graph with Windows 2000?

    Do you that any pointers as to what I am doing wrong?

    Thank you,

    Todd
     
    Todd Gardner, Jun 15, 2004
    #16
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.