Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: Numbers on rectangles

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130099] Re: Numbers on rectangles
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 9 Mar 2013 05:26:03 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20130308214748.C87C766F8@smc.vnet.net>

Module[{pt, n = 1},
 Graphics[{
   EdgeForm[Black],
   Table[
    {Opacity[.5],
     Hue[RandomReal[]],
     Rotate[
      Rectangle[pt = RandomReal[2, 2]],
      RandomReal[2 Pi]],
     Opacity[1],
     Black,
     Text[Style[n++, Bold, 18], pt + {.5, .5}]},
    {RandomInteger[{1, 9}]}]}]]


Bob Hanlon


On Fri, Mar 8, 2013 at 4:47 PM,  <c_mcinnis at hotmail.com> wrote:
> Hello to all,
> I am trying to put numbers on rectangles. I found this little demonstration under the heading of =93Rectangles=94->=94Neat Examples=94. I thought that it would be a good tool to help a young student learn to count, however I cannot find a way to put numbers on the rectangles. I looked at a couple of examples in the demonstrations projects where numbers had been assigned to disks, however that didn't seem to work with rectangles. I also saw some documentation in the help section on =93Inset=94 that labeled a circle, but that did not work either. After finding no posts regarding this topic either here or at the education forum, I decided that I might try to ask.
>
> Graphics[{EdgeForm[Black],
>   Table[{Hue[RandomReal[]],
>     Rotate[Rectangle[RandomReal[2, 2]], RandomReal[2 Pi]]}, {20}]}]
>
> I have modified the code to produce a random, and smaller, number of rectangles, as is shown below.
>
> Graphics[{EdgeForm[Black],
>   Table[{Hue[RandomReal[]],
>     Rotate[Rectangle[RandomReal[2, 2]],
>      RandomReal[2 Pi]]}, {RandomInteger[{1, 9}]}]}]
>
> Would love to have each rectangle take on a distinct color, the more basic ones if possible, but just having a number on each rectangle would be great. Many thanks for any and all considerations and suggestions.
> Clifton
>



  • Prev by Date: Re: dark halo around gaussian peak in Plot3D?
  • Next by Date: Re: dark halo around gaussian peak in Plot3D?
  • Previous by thread: Re: Numbers on rectangles
  • Next by thread: Re: Numbers on rectangles