Re: Spurious Line

• To: mathgroup at smc.vnet.net
• Subject: [mg75049] Re: Spurious Line
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sun, 15 Apr 2007 05:12:11 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <evpoeu\$69p\$1@smc.vnet.net>

```Jeff Albert wrote:
> When I run the following I get what is obviously a spurious straight line
> connecting (-100,0) and (300,400*.7).  How do I get rid of that line?
>
> {{-100,0},{0,-100},{100,-200*.9},{200,-300*.8},{300,-400*.7},{-100,0},{0,100
> },{100,200*.9},{200,300*.8},{300,400*.7}}
>
> ListPlot[%, PlotJoined->True]
>
> Jeff

Hi Jeff,

There is no spurious line in the plot, indeed. The option PlotJoined
draws a line between each pair of points. The pairs are a partition of
the list of points with an offset of one. First, a line is drawn between
points 1 and 2, then a line is drawn between points 2 and 3, and so on.
Evaluating the following expressions will show a step by step building
of the plot and the creation of the incriminated line.

In[1]:=
list = {{-100, 0}, {0, -100}, {100, -200*0.9},
{200, -300*0.8}, {300, -400*0.7}, {-100, 0},
{0, 100}, {100, 200*0.9}, {200, 300*0.8},
{300, 400*0.7}};

Needs["Graphics`Graphics`"];

g = (ListPlot[##1, PlotJoined -> True, Frame -> True,
DisplayFunction -> Identity, PlotRange ->
{{Min[list[[All,1]]], Max[list[[All,1]]]},
{Min[list[[All,2]]], Max[list[[All,2]]]}},
PlotLabel -> StringJoin["Drawing line from ",
ToString[First[##1]], " to ",
ToString[Last[##1]]], PlotStyle ->
{Red, AbsoluteThickness[3]}] & ) /@
Partition[list, 2, 1];

Do[DisplayTogether[g[[Range[n]]]], {n, 1, Length[g]}]

Regards,
Jean-Marc

```

• Prev by Date: RE: Printing Notes
• Next by Date: Mathematica SIG (Northern Virginia and Washington DC)
• Previous by thread: Re: Spurious Line
• Next by thread: Re: Units of MaxBend?