From: Hidetoshi NAGAI Date: 2006-09-29T11:35:42+09:00 Subject: Re: CanvasPlot, createPlotAxis and createLinePlot. From: Patrick Lynch Subject: Re: CanvasPlot, createPlotAxis and createLinePlot. Date: Fri, 29 Sep 2006 04:51:28 +0900 Message-ID: > I've done that...can you tell me how to add tick marks and coordinate > values and possibly even coordinate labels? > > FYI > > 0----10----20----30----40---... > Label: this is the x-axis... > > a similar thing for the y-axis... Do you want to use this from Ruby? vvvv It seems that the package is constructed with standard canvas items only. Why don't you translate it to Ruby/Tk? ;-) Anyway, translation is not so difficult, if you can read the Perl source. For example, ------------------------------------------------------ if ($y_axis) { $self->createText( $x1-$tl, $y2-$x, -text => $l, %args, -fill => $tcolor, -font => $lfont, -anchor => $an, ); } else { $self->createText( $x+$x1, $y1+$tl, -text => $l, %args, -fill => $tcolor, -font => $tfont, -anchor => $an, ); } --------------------------------------------------------------- ------------------------------------------------------ if (y_axis) { TkcText.new(self, x1-tl, y2-x, args.merge(:text=>l, :fill=>tcolor, :font=>lfont, :anchor=>an) ) } else { TkcText.new(self, x+x1, y1+tl, args.merge(:text=>l, :fill=>tcolor, :font=>tfont, :anchor=>an) ) } --------------------------------------------------------------- However, if you want to create beautiful graphs, I recommend you to use BLT ( or Tcllib(Tklib) ) extension. Current Ruby/Tk has a binding for BLT ( and Tcllib(Tklib) ). -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)