MathGroup Archive 1997

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

Search the Archive

Re: Locating text in Show

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8286] Re: [mg8205] Locating text in Show
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Sun, 24 Aug 1997 04:46:27 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

"Steven T. Hatton" <hattons at cpkwebser5.ncr.disa.mil>
in [mg8205] Locating text in Show
writes as below the line ***************

Steven
1. To get  equally scaled coordinates (so that circles look like  
circles ) use
 	AspectRation-> Automatic
   	*not *Aspect Ratio -> 1, which just makes the picture square.
2. Offsets for text need to be set explicitely:
		Text["text", {x,y},{ox,oy}]
		

<< Geometry`Polytopes`
dots = Vertices[Octagon];
sh1= Show[
	Graphics[{
		Circle[{0, 0}, 1],	(*drawn first*)
		PointSize[0.03], Point /@ dots (*goes on top*)
    }],
    AspectRatio -> Automatic,
    PlotRange -> All
];

sh2 =Show[Graphics[{Thread[Text[{A, B, C, D},
      {dots[[1]], dots[[2]], dots[[3]], dots[[4]]},
      {-2, -2}], List, 2]}]];

3. In the preceding display, since no options have been set  not  
all the letters show, and the scaling is not even. If you want to  
see things properly then repeated the earlier options. But this is  
only to do with appearence - the data that we need is there to use.

Show[sh1,sh2];


4. The options fron sh1 are inherited to give the desired aspect  
ratio and show the letters.
5. If you are not interested in a visual check on the construction,  
then only put in the  options at the end

Show[sh1,sh2, AspecRatio -> Automatic, PlotRange->All]

6. We can also do it at one go:
Show[
	Graphics[{
		Circle[{0, 0}, 1],
		PointSize[0.03],
        Point /@ #1,
        Thread[
        	Text[{A, B, C, D},
          	Take[#1, 4], {-2, -2}],
          	List,
          	2
          ]
     }]&[Vertices[Octagon]],
     AspectRatio -> Automatic,
   	PlotRange -> All
 ];

Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/training.html
voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester,  UK


***************
I am trying to label points in a graph that I am generating with the
following.  Before I attempt to overlay the two graphics objects I want
to get the text to locate in conjunction with the points on the circle.
In other words I need to locate the text at the vertices of the octagon
with an offset.  I am finding that all but the first three points of
"dots" are located at the bottom of the graph.  Does anybody have some
insight into what is going on here?

<< Geometry`Polytopes`
dots=Vertices[Octagon]
Show[Graphics[{{PointSize[.03], Point /@ dots},{Circle[{0,0},1]}},
        AspectRatio -> 1]]
Show[Graphics[{
      Thread[Text[{A, B, C,
D},{dots[[1]],dots[[2]],dots[[3]],dots[[4]]}   ]]},
    AspectRatio->1,PlotRange->All]]


  • Prev by Date: Simplifying Sqrt[a^2*d^2] -> a*d
  • Next by Date: Re: Locating text in Show
  • Previous by thread: Locating text in Show
  • Next by thread: Re: Locating text in Show