RE: Graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg34817] RE: [mg34800] Graphics
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 8 Jun 2002 05:21:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Shz Shz, Needs["Graphics`Colors`"] square = Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}]; triangle = Line[{{1, 0}, {3, 0}, {2, 1}, {1, 0}}]; Show[Graphics[ {MediumBlue, square, VenetianRed, triangle}], AspectRatio -> Automatic, Background -> Linen]; If you want solid squares and rectangles... Show[Graphics[ {MediumBlue, Polygon @@ square, VenetianRed, Polygon @@ triangle}], AspectRatio -> Automatic, Background -> Linen]; If you want the sides to be arrows... Needs["Graphics`Arrow`"] squaresides = Partition[#, 2, 1] & @@ square {{{0, 0}, {1, 0}}, {{1, 0}, {1, 1}}, {{1, 1}, {0, 1}}, {{0, 1}, {0, 0}}} trianglesides = Partition[#, 2, 1] & @@ triangle {{{1, 0}, {3, 0}}, {{3, 0}, {2, 1}}, {{2, 1}, {1, 0}}} Show[Graphics[ {MediumBlue, Arrow @@ # & /@ squaresides, VenetianRed, Arrow @@ # & /@ trianglesides}], AspectRatio -> Automatic, Background -> Linen]; The DrawGraphics package at my web site has Arrow routines for placing the arrowheads anywhere along the side. If you are working with graphs or using Combinatorica you may wish to use the CombinatoricaPlots package also at my web site. It gives complete control of styles and labeling of edges and vertices. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: Shz Shz Oon [mailto:OONSSHZ at hitachi.com.my] To: mathgroup at smc.vnet.net > > > Hi all, > I have a very simple question. Maybe it is too simple to ask but > i really need help. > Does anyone know how to > 1) draw a triangle > 2) draw a square > with mathematica" ? > I try to draw them by loading the Graphics'Arrow' package but it seem > to benothing come out. > > Thank you in advance! > Shz Shz > >