Re: What's wrong in this plot?
- To: mathgroup at smc.vnet.net
- Subject: [mg15026] Re: [mg15003] What's wrong in this plot?
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Wed, 9 Dec 1998 04:12:14 -0500
- Sender: owner-wri-mathgroup at wolfram.com
On Sat, Dec 5, 1998, <sergio at scisun.sci.ccny.cuny.edu> wrote: >(* > Hello everyone: > > I'm using the following code to plot a set of individual > rectangles, labeling each each rectangle with a number at > the center. After that, the plots are combined in a single > one using Show. The problem is that only the label of the first > rectangle is shown in the combined plot. Could somebody point > out what is going and how to overcome the problem? > > Regards, > Sergio > E-mail: sergio at scisun.sci.ccny.cuny.edu *) > >Clear[data]; >data ÿ{-20., 0.}, {-20., -10.}, {-10., -10.}, {-10., 0.}, {-20., 10.}, > {-20., 0.}, {-10., 0.}, {-10., 10.}, {-10., 0.}, {-10., -10.}, > {0., -10.}, {0., 0.}, {-10., 10.}, {-10., 0.}, {0., 0.}, {0., >10.}, > {0., 0.}, {0., -10.}, {10., -10.}, {10., 0.}, {0., 10.}, {0., >0.}, > {10., 0.}, {10., 10.}, {10., 0.}, {10., -10.}, {20., -10.}, >{20., 0.}, > {10., 10.}, {10., 0.}, {20., 0.}, {20., 10.}}; > >Clear[gridplot, label, midx, midy]; >gridplot ÿ}; >label ð; >Do[ > midx ÿdata[[k]][[1]] + data[[k+3]][[1]])/2.0 ; > midy ÿdata[[k]][[2]] + data[[k+1]][[2]])/2.0 ; > label ÿabel + 1; > AppendTo[gridplot, > >ListPlot[Append[Table[data[[i]],{i,k,k+3}],data[[k]]], > PlotJoined -> True, > Axes -> False, > Epilog -> Text[label,{midx,midy}], > DisplayFunction -> Identity]], > {k,1,Length[data],4}]; >Show[gridplot[[4]], Frame -> True, DisplayFunction -> $DisplayFunction]; >Show[gridplot[[7]], Frame -> True, DisplayFunction -> >$DisplayFunction]; Show[gridplot, Frame -> True, DisplayFunction -> >$DisplayFunction]; > >-----------ÿPosted via Deja News, The Discussion Network ÿ--------- >http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own > The problem is with your using Epilog. If you simply combine your text objects with the rectangles as separate graphic objects everything works fine: In[47]:Clear[data]; data ÿ{-20., 0.}, {-20., -10.}, {-10., -10.}, {-10., 0.}, {-20., 10.}, {-20., 0.}, {-10., 0.}, {-10., 10.}, {-10., 0.}, {-10., -10.}, {0., -10.}, {0., 0.}, {-10., 10.}, {-10., 0.}, {0., 0.}, {0., 10.}, {0., 0.}, {0., -10.}, {10., -10.}, {10., 0.}, {0., 10.}, {0., 0.}, {10., 0.}, {10., 10.}, {10., 0.}, {10., -10.}, {20., -10.}, {20., 0.}, {10., 10.}, {10., 0.}, {20., 0.}, {20., 10.}}; Clear[gridplot, label, midx, midy]; gridplot ÿ}; label ð; Do[ midx ÿdata[[k]][[1]] + data[[k+3]][[1]])/2.0 ; midy ÿdata[[k]][[2]] + data[[k+1]][[2]])/2.0 ; label ÿabel + 1; AppendTo[gridplot, {ListPlot[Append[Table[data[[i]],{i,k,k+3}],data[[k]]], PlotJoined -> True, Axes -> False, DisplayFunction -> Identity], Graphics[Text[label,{midx,midy}]]}], {k,1,Length[data],4}]; Show[gridplot[[4]], Frame -> True, DisplayFunction -> $DisplayFunction]; Show[gridplot[[7]], Frame -> True, DisplayFunction -> $DisplayFunction]; Show[gridplot, Frame -> True, DisplayFunction -> $DisplayFunction]; Andrzej Kozlowski Toyama International University JAPAN