Hello, I would need to create a very simple visualisation for some scientific work I am doing. Basically I need to draw points in a 2D graph (and specify which colours to use) and each time the user presses the spacebar it should move to the next iteration and show (say with a line) where everyone is. What would be the simplest way to go about this? The first priority is simplicity followed by easy to learn. I don't need either a powerful system nor something that looks pretty (I am the only one who'll use it ^_^). thank you in advance Diego
on 2009-02-16 13:08
on 2009-02-16 13:10
Diego Virasoro wrote: > Hello, > I would need to create a very simple visualisation for some scientific > work I am doing. Basically I need to draw points in a 2D graph (and > specify which colours to use) and each time the user presses the > spacebar it should move to the next iteration and show (say with a > line) where everyone is. > > What would be the simplest way to go about this? Any GUI tool with the word "canvas" in it, such as TkCanvas.
on 2009-02-16 15:42
> What would be the simplest way to go about this? It'll probably help to use an existing graphing package, as this will take care of some of the tricky things for you such as scaling of axis limits and plot styles. Perhaps Gnuplot would work? Depending on which OS you are using it can be easy to set up and use from Ruby, but you will have to become a little familiar with Gnuplot to be able to control some things. I wrote about using Gnuplot with Ruby recently: http://blog.chrislowis.co.uk/2008/12/01/curve-fit-... Hope this helps, Chris
on 2009-02-16 18:21
Diego Virasoro (in comp.lang.ruby): > need either a powerful system nor something that looks pretty (I am > the only one who'll use it ^_^). > The Ming library <http://www.libming.net/> allows you to generate Flash SWF files, and there is a Ruby interface package <http://mingruby.rubyforge.org/>, look here <http://rubyforge.org/news/?group_id=428> for latest versions. The documentation is not really existent, though. You have to look into the (numerous) example files that come with the package, and look up the corresponding functions in the Perl interface doc <http://www.libming.net/docs/perl/index.html>. I just downloaded and installed it and want to use it to learn both Ruby and Flash. Joachim
on 2009-02-16 18:46
Diego Virasoro wrote: > need either a powerful system nor something that looks pretty (I am > the only one who'll use it ^_^). Hi, Have a look at FXRuby, a great and easy to use library. As a tutorial, you can have a look at this: http://www.attiksystem.ch/index.php/2008/02/21/dou... y/ Regards, Philippe
on 2009-02-16 21:02
Phlip wrote: > Any GUI tool with the word "canvas" in it, such as TkCanvas. TkCanvas is pretty good for 2D animations. I've used it in engineering tools (including as a plug-in block for a simulink-based tool for a car company). I developed a general tool called tkar that runs as a standalone process: http://path.berkeley.edu/~vjoel/vis/tkar/ It's based on ruby/tk, but you can feed it data from anywhere, not just ruby code. It accepts data from pipes and sockets. Your controlling process can decide when to send data, so you would probably handle spacebar events on the upstream end of the socket. It handles basic user interaction fairly well, allowing pan, zoom, click, drag-n-drop (the latter two send the commands back out the socket, so you can control the effects). For an overview, see http://path.berkeley.edu/~vjoel/vis/tkar/tkar.html and of course the movie http://path.berkeley.edu/~vjoel/vis/tkar/movie.gif Full docs--most importantly the data stream protocol and shape defs--are in http://path.berkeley.edu/~vjoel/vis/tkar/doc/ The program itself is all one file: http://path.berkeley.edu/~vjoel/vis/tkar/tkarpi.rb This simulink plugin is quite nice--beats the native simulink 2D animation, and is just about as flexible as the simulink plotter block. But probably not of interest on this list. HTH.
on 2009-02-16 21:40
Joel VanderWerf wrote: >> >> Any GUI tool with the word "canvas" in it, such as TkCanvas. > > TkCanvas is pretty good for 2D animations. On second thought... Writing ruby/tk code directly (rather than over a socket as I suggested) is probably a better idea for an animation that's this simple. - tkar is especially good if you want to define some complex shapes and then move them about, rotate them, change their shape params, etc. - using ruby/tk directly may be better if you have a grid of colored squares and just want to change each square's color over time. Probably there's even an example you could adapt.
on 2009-02-17 00:28
Ruby-processing can be an option. http://wiki.github.com/jashkenas/ruby-processing It's basically a ruby port of processing which is written in java. (http://processing.org). So you need jruby. Take a look at the examples then you'll see how simple it is to use.