Re: Postfix specification graphics, etc.
- To: mathgroup at smc.vnet.net
- Subject: [mg118460] Re: Postfix specification graphics, etc.
- From: Heike Gramberg <heike.gramberg at gmail.com>
- Date: Fri, 29 Apr 2011 07:29:29 -0400 (EDT)
To get the points on top of the lines you need to list the points in the Graphics argument after all the lines, e.g. Graphics[{Thickness[0.02], PointSize[0.05], Table[{Hue[0.8 (i - 1)/9], Line[P[[i]] ]}, {i, 1, 11}], Table[{Hue[0.8 (i - 1)/9], Point /@ P[[i]] }, {i, 1, 11}]}] (note that you don't have to repeat Thickness[0.02] and PointSize[0.05] in each iteration). You can also Transpose the original Table: Graphics[{Thickness[0.02], PointSize[0.05], Transpose[Table[{{Hue[0.8 (i - 1)/9], Line[P[[i]] ]}, {Hue[0.8 (i - 1)/9], Point /@ P[[i]] }}, {i, 1, 11}]]}] By the way, to get the lists of start and finish points, why not simply use something like S = P[[All,1]]; F = P[[All,-1]]; Heike. On 28 Apr 2011, at 11:34, Christopher O. Young wrote: > I think I'm finally catching on to the pure function notation enough to put > everything into the kind of postfix notation I prefer. It just seems > preferable to me to have the geometrical objects positioned first, where > they're most prominent, and have the commands that modify their display > following them. > > For example, the following plots a "trammel" sliding in a corner, always > tangent to the same hyperbola. All the lines are colored with corresponding > colors for the points. > > > P = {{0, k}, {10 - k, 0}}~Table~{k, 0, 10}; > (* Points for the lines *) > > S = Drop[P, {}, {2}] // Flatten[#, 1] &; > (* The start points *) > > F = P // Drop[#, {}, {1}] & // Flatten[#, 1] &; > > (* The finish points *) > > ({ > Line[{S[[j]], F[[j]]}] // {Hue[0.8 (j - 1)/9],Thickness[0.02], #} &, > {Point[S[[j]]], Point[F[[j]]]} //{Hue[0.8 (j - 1)/9],PointSize[0.05],#} & > > } > ~Table~{j, 1, 11})\ > // Graphics > > It's a little irritating to have to add parentheses to get Graphics to have > enough scope, and a backslash to continue to the next line, but I still like > getting the lines and points first. > > One interesting thing here is that > > {Hue[0.8 (j - 1)/9],Thickness[0.02], #} & > > is being used as a pure function, i.e., the list function, so that I can > list each set of graphics directives after the objects they modify. > > Also it's lucky that I can get away with putting the points in a list and > then applying the directives via another list, since I haven't been able to > get it to work via numbered slots (i.e., #1, #2, etc.). > > > I don't think it's accidental that the "//" form resembles the "pipe" > operator from Unix, since it seems to be possible to use it for the same > purpose, to "pipe" the output of one command into another. > > One question: How do I get all the points to plot on top? > > Chris Young > cy56 at comcast.net > IntuMath.org > > >