Re: Text Alignment in Graphics[]
- To: mathgroup at smc.vnet.net
- Subject: [mg127637] Re: Text Alignment in Graphics[]
- From: "djmpark" <djmpark at comcast.net>
- Date: Thu, 9 Aug 2012 03:52:43 -0400 (EDT)
- 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: <4997117.26647.1344476228986.JavaMail.root@m06>
Matthias,
Use the third argument in Text, which gives the alignment of the text with
the location.
Graphics[{{EdgeForm[Thin], White,
Rectangle[{0, 0}, {32.5 + 10 + 73.5 + 0.85 + 1.5,
34.8}]}, {Polygon[{{0, 0}, {32.5, 0}, {32.5, 21.9}, {32.5 + 10,
31.9}, {32.5 + 10 + 73.5, 31.9}, {32.5 + 10 + 73.5,
30.9}, {32.5 + 10 + 73.5 + 0.85,
30.9}, {32.5 + 10 + 73.5 + 0.85,
31.9}, {32.5 + 10 + 73.5 + 0.85 + 1.5,
31.9}, {32.5 + 10 + 73.5 + 0.85 + 1.5,
33.8}, {32.5 + 10 + 73.5 + 0.85,
33.8}, {32.5 + 10 + 73.5 + 0.85, 34.8}, {32.5 + 10 + 73.5,
34.8}, {32.5 + 10 + 73.5, 33.8}, {30.6, 33.8}, {30.6,
11.9}, {20.6, 1.9}, {0, 1.9}, {0, 0}}]}, {Text[
1183.5*mm, {118.35/2, 36.8}]}, {Rotate[
Text[348*mm, {120.35, 35.5/2}], 90*Degree]}, {Rotate[
Text[319*mm, {98, 31.9/2}], 90*Degree]}, {Dashed,
Line[{{0, 17.4}, {118.35, 17.4}}],
Line[{{100, 0}, {100, 31.9}}]}, {Text[
325*mm, {32.5/2, 19.4}]}, {Text[(118.35 - 32.5 - 1.9)*
mm, {118.35/2 + 16 + 1.9, 19.4}]}, {Text[
"Material:Blankstahl, rund, Durchmesser 19 \ mm.", {0, -3}, \
{-1, 0}]}, {Text[
"Passierstift dito, \ Durchmesser 8,5 mm, L=E4nge 39 mm.", {0, \
-6}, {-1, 0}]},
{Text["Stummell=E4nge oben rechts 15 mm.", {0, -9}, {-1,
0}]}, {Text[
"Versteifungsdreiecke 6 mm, \ 100 x 100 x 141,4 mm.", {0, \
-12}, {-1, 0}]}, {FontWeight -> Bold,
Text["Anwerfkurbel FJ40, Maschine 2F", {118.35/2, 42}]}},
ImageSize -> 400]
Rectangles have RoundingRadius as an option but Polygon doesn't and I don't
know of an easy method to round the corners. There probably is a hard way by
writing an algorithm putting gaps at the Polygon corners and inserting a
rounded set of points.
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/index.html
From: Matthias Bode [mailto:lvsaba at hotmail.com]
Hola:
1. I have these graphics (it's a crank I designed and built)
Graphics[{{EdgeForm[Thin], White, Rectangle[{0, 0}, {32.5 + 10 + 73.5
+ 0.85 + 1.5, 34.8}]}, {Polygon[{{0, 0}, {32.5, 0}, {32.5,
21.9}, {32.5 + 10, 31.9}, {32.5 + 10 + 73.5, 31.9},
{32.5 + 10 + 73.5, 30.9}, {32.5 + 10 + 73.5 + 0.85, 30.9},
{32.5 + 10 + 73.5 + 0.85, 31.9}, {32.5 + 10 + 73.5 + 0.85 + 1.5,
31.9}, {32.5 + 10 + 73.5 + 0.85 + 1.5, 33.8}, {32.5 + 10
+ 73.5 + 0.85, 33.8}, {32.5 + 10 + 73.5 + 0.85, 34.8},
{32.5 + 10 + 73.5, 34.8}, {32.5 + 10 + 73.5, 33.8}, {30.6,
33.8}, {30.6, 11.9}, {20.6, 1.9}, {0, 1.9}, {0, 0}}]},
{Text[1183.5*mm, {118.35/2, 36.8}]}, {Rotate[Text[348*mm, {120.35,
35.5/2}], 90*Degree]}, {Rotate[Text[319*mm, {98, 31.9/2}],
90*Degree]}, {Dashed, Line[{{0, 17.4}, {118.35, 17.4}}], Line[{{100,
0}, {100, 31.9}}]}, {Text[325*mm, {32.5/2, 19.4}]}, {Text[(118.35
- 32.5 - 1.9)*mm
, {118.35/2 + 16 + 1.9, 19.4}]}, {Text[
"Material:Blankstahl, rund, Durchmesser 19 \ mm.", {32, -3}]},
{Text["Passierstift dito, \ Durchmesser 8,5 mm, L=E4nge 39 mm.", {36,
-6}]}, {Text["Stummell=E4nge oben rechts 15 mm.", {23, -9}]},
{Text["Versteifungsdreiecke 6 mm, \ 100 x 100 x 141,4 mm.", {34.5,
-12}]}, {FontWeight -> Bold, Text["Anwerfkurbel FJ40, Maschine
2F", {118.35/2, 42}]}}]
The rectangle's lower left corner is at {0, 0}, for the texts
{Text[ "Material:Blankstahl, rund, Durchmesser 19 \ mm.",{32,
-3}]}, {Text["Passierstift dito, \ Durchmesser 8,5 mm, L=E4nge 39 mm.",
{36, -6}]}, {Text["Stummell=E4nge oben rechts 15mm.", {23,
-9}]}, {Text["Versteifungsdreiecke 6 mm, \ 100 x 100 x 141,4 mm.", {34.5,
-12}]},
to be left aligned along the ordinate below the rectangle I have to set
their x-coordinates, depending on the length of each text, between 23 and 36
rather than 0 as one might expect. These settings for x only work for a
given size of the graphics. When I increase the size the texts move to right
but not uniformly so. The texts inside the rectangle, the header and
{Text[1183.5*mm, {118.35/2, 36.8}]}, {Rotate[Text[348*mm, {120.35,35.5/2}],
90*Degree]}, however, move to their appropriate places.
How can the undesirable eastward migration of the texts below the rectangle
be remedied?
2. Is there a symbol analogous to JoinForm["Round"] to round a polygon's
corners? (EdgeForm[] does not accept "Round".) Best regards,
MATTHIAS BODE
S 17.35775=B0, W 066.14577=B0
2'740 m
AMSL.