From ifinvers at ucalgary.ca Wed Apr 11 13:08:58 2007 From: ifinvers at ucalgary.ca (Ivars Finvers) Date: Wed, 11 Apr 2007 11:08:58 -0600 Subject: [Tioga-users] Grid lines Message-ID: <88D7E30D-BEBA-4358-91B7-F6C324997878@ucalgary.ca> Hi, Is it possible to produce grid lines in a Tioga plot? I've looked through the examples and documentation and was unable to any mention of grid lines. Thanks. Ivars From jeanjulien.fleck at gmail.com Thu Apr 12 04:31:44 2007 From: jeanjulien.fleck at gmail.com (Fleck Jean-Julien) Date: Thu, 12 Apr 2007 10:31:44 +0200 Subject: [Tioga-users] dvector.each_many ? Message-ID: Hello ! I have loved the routine @x.each2(@y) do |x,y| ... end to progress into 2 dvectors simultaneously, but unfortunately, I do most of my work (when using dvectors outside of Tioga) with 3 dimensions or more so I wonder if it would be possible to implement an each_many routine that could be used as @x.each_many(@y, at z, at t, at u, at v, at w) do |x,y,z,t,u,v,w| ... end and which determines automaticaly how many Dvectors to use from the number of arguments. For the moment, I get along with indexes but it's less convenient in writing. Cheers, JJ From edder at tkwsping.nl Thu Apr 12 05:08:42 2007 From: edder at tkwsping.nl (Edwin) Date: Thu, 12 Apr 2007 10:08:42 +0100 Subject: [Tioga-users] dvector.each_many ? In-Reply-To: References: Message-ID: > I have loved the routine > > @x.each2(@y) do |x,y| ... end > > to progress into 2 dvectors simultaneously, but unfortunately, I do > most of my work (when using dvectors outside of Tioga) with 3 > dimensions or more so I wonder if it would be possible to implement an > each_many routine that could be used as > > @x.each_many(@y, at z, at t, at u, at v, at w) do |x,y,z,t,u,v,w| ... end > > and which determines automaticaly how many Dvectors to use from the > number of arguments. > > For the moment, I get along with indexes but it's less convenient in > writing. You can add this capability yourself, by augmenting the Dvector class as follows: module Dobjects class Dvector def each_many( *vectors, &block ) self.each_index do |i| args = Array.new vectors.each { |v| args.push( v[i] ) } block.call( self[i], *args ) end end end end Example: require 'Dobjects/Dvector' include Dobjects module Dobjects class Dvector def each_many( *vectors, &block ) self.each_index do |i| args = Array.new vectors.each { |v| args.push( v[i] ) } block.call( self[i], *args ) end end end end v1 = Dvector[1,2] v2 = Dvector[3,4] v3 = Dvector[5,6] v1.each_many(v2,v3) { |x,y,z| p x+y+z } => 9.0 => 12.0 From paxton at kitp.ucsb.edu Thu Apr 12 19:51:37 2007 From: paxton at kitp.ucsb.edu (Bill Paxton) Date: Thu, 12 Apr 2007 16:51:37 -0700 Subject: [Tioga-users] Grid lines In-Reply-To: <88D7E30D-BEBA-4358-91B7-F6C324997878@ucalgary.ca> References: <88D7E30D-BEBA-4358-91B7-F6C324997878@ucalgary.ca> Message-ID: On Apr 11, 2007, at 10:08 AM, Ivars Finvers wrote: > > Is it possible to produce grid lines in a Tioga plot? I've looked > through the examples and documentation and was unable to any mention > of grid lines. > Hi Ivars, There isn't anything special for grid lines in Tioga (at least not yet!), but you can do-it-yourself pretty easily. Here's the "Blues Plot" from samples/ plots.rb with grid lines added by hand. def blues_with_grid read_data t.do_box_labels('Blues Plot', 'Position', '\textcolor[rgb] {0,0,1}{Blues}') show_model_number xs = @positions ys = @blues t.show_plot(plot_boundaries(xs,ys, at margin,-1,1)) { t.context { t.line_width = 0.5 t.line_type = Line_Type_Dot t.line_color = Gray [0,2,4,6].each {|x| t.stroke_line (x,t.bounds_top,x,t.bounds_bottom) } [-1,-0.5,0,0.5,1].each {|y| t.stroke_line (t.bounds_left,y,t.bounds_right,y) } } t.show_polyline(xs,ys,Blue) } end -------------- next part -------------- A non-text attachment was scrubbed... Name: Blues_with_grid.pdf Type: application/pdf Size: 13112 bytes Desc: not available Url : http://rubyforge.org/pipermail/tioga-users/attachments/20070412/a1684860/attachment-0001.pdf -------------- next part -------------- Cheers, Bill From jeanjulien.fleck at gmail.com Fri Apr 13 03:24:34 2007 From: jeanjulien.fleck at gmail.com (Fleck Jean-Julien) Date: Fri, 13 Apr 2007 09:24:34 +0200 Subject: [Tioga-users] dvector.each_many ? In-Reply-To: References: Message-ID: Hello, > You can add this capability yourself, by augmenting the Dvector class as > follows: Thanks for the trick Edwin, I'll do this. Cheers, JJ