MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

What's wrong in this plot?


(*
   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 = 0;
Do[
           midx = (data[[k]][[1]] + data[[k+3]][[1]])/2.0 ;
           midy = (data[[k]][[2]] + data[[k+1]][[2]])/2.0 ;
          label = label + 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



  • Prev by Date: RE: Reading Native Excel files->Solution
  • Next by Date: RE: New Notebook looses focus after first keystroke
  • Previous by thread: RE: Reading Native Excel files->Solution
  • Next by thread: Re: What's wrong in this plot?