       RE: a very simple graphics problem

• To: mathgroup at smc.vnet.net
• Subject: [mg61072] RE: [mg61050] a very simple graphics problem
• From: Francisco Gutierrez <fgutiers2002 at yahoo.com>
• Date: Sun, 9 Oct 2005 01:35:39 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```This help is greatly appreciated, David. I always read your messages with great interest, and I was hoping that my query was answered precisely by you. So thanks. Best regards,
Fg

David Park <djmp at earthlink.net> wrote:
Francisco,

astray, or at least makes things very complicated for them. This is because
of the switching of graphical levels between Plots and graphical primitives.
It would be much simpler if everything was treated as a graphic primitive.

In this case, the solution is very simple. You don't need ListPlot. Throw it
in the garbage can. Trash it. Kaput. Instead you can just Map the Point

You last line escaped the triangle because I think you left out the decimal
point. (I also used AbsolutePointSize instead of PointSize. You may wish to
adjust my choice. Also, I think one should use AspectRatio here.) Fixing
jo5, we then have...

Needs["Graphics`Colors`"]

triangulo = Line[{{0, 0}, {0.5, 0.5}, {1, 0}, {0, 0}}];
milista = {{0.589286, 0.330357}, {0.553571, 0.4375}, {0.552632,
0.429825}, {0.508772, 0.0526316}, {0.578947, 0.342105}, {0.57,
0.26}, {0.57, 0.29}, {0.48, 0.25}};
jo1 = Line[{{0.5, 0}, {0.5, 0.5}}];
jo2 = Line[{{0.4, 0.4}, {0.8, 0}}];
jo3 = Line[{{0.4, 0.4}, {0.8, 0}}];
jo4 = Line[{{0.1, 0.1}, {0.2, 0}}];
jo5 = Line[{{0.8, 0}, {0.9, 0.1}}];

Show[Graphics[
{triangulo, jo1, jo2, jo3, jo4, jo5,
AbsolutePointSize, Point /@ milista}],
AspectRatio -> Automatic,
PlotRange -> All,
Background -> Linen,
ImageSize -> 500];

Everything was at the primitive graphics level and we could just draw one
item after another, adding in the point size where we wanted it to take
effect.

To color and label the points you could use something like...

Show[Graphics[
{triangulo, jo1, jo2, jo3, jo4, jo5,
AbsolutePointSize,
Text[#3, #2, {-1.5, 0}]} &, {Table[i, {i, 0, 0.8, 0.8/7}],
milista, Range[Length[milista]]}, 1]}],
AspectRatio -> Automatic,
TextStyle -> {FontSize -> 10},
PlotRange -> All,
Background -> Linen,
ImageSize -> 600];

If you wanted to add curves to your plot, such as you might create with
Plot, then you could try the DrawGraphics package at my web site, which
automatically converts curve plotting to primitive graphics. But here you
don't need it because everything is primitive graphics to begin with.

David Park

From: Francisco Gutierrez [mailto:fgutiers2002 at yahoo.com]
To: mathgroup at smc.vnet.net

Dear Friends:
This is a quite primitive problem (actually, 2 related problems).
I have a set of points, which I want to put into a triangle and then draw
some lines.
The triangle I build in the following way=

triangulo=Line[{{0,0},{0.5,0.5},{1,0},{0,0}}];

The I christen my set of points:

milista={{0.589286,0.330357},{0.553571,0.4375},{0.552632,0.429825},{0.508772
,0.0526316},{0.578947,0.342105},{0.57,0.26},{0.57,0.29},{0.48,0.25}}

I make a graphic:

miejemplito=ListPlot[milista, PlotStyle®{PointSize[0.03]} ]

Then I put them into the triangle:

Show[Graphics[triangulo], miejemplito, PlotRange®All]

All this works fine. I start to draw the lines:

jo1=Line[{{0.5,0},{0.5,0.5}}];

jo2=Line[{{0.4,0.4},{0.8,0}}];

jo3=Line[{{0.4,0.4},{0.8,0}}];

jo4=Line[{{0.1,0.1},{0.2,0}}];

and then

Show[Graphics[triangulo],Graphics[jo1],Graphics[jo2],Graphics[jo3],
Graphics[jo4], miejemplito, PlotRange®All]

So far, so good. However, when I add

jo5=Line[{{0.8,0},{0.9,01}}];

and then give the directive

Show[Graphics[triangulo],Graphics[jo1],Graphics[jo2],Graphics[jo3],
Graphics[jo4],Graphics[jo5], miejemplito, PlotRange®All], I get an extremely
awkward and badly drawn graphic, and the last line (jo5) escapes the
triangle.

a. How can I correct the problem?

b. How can I put labels to each point (and eventually colour them
differently)?