| Author |
Comment/Response |
Forum Moderator
email me
 |
12/10/01 2:39pm
Here is a quite inelegant and not very Mathematica-spirted way to produce the
lines without the connectors. Somebody out there might be able
to come up with a more elegant functional programming or pattern matching method.
The basic idea is to get at the list of points from the Graphics expression created by
ParametricPlot.
In[4]:= plotList=ParametricPlot[{theta1[t],theta2[t]},{t,0,20},AspectRatio->1]
You can see the Graphics expression by looking at InputForm[plotList]. You will see that
all of the points have been gathered into one Line primitive, which is why all of the points
are connected. You can get at the points using Part notation, [[]].
The points list is:
In[5]:= pts = plotList[[1, 1, 1, 1]];
Looking at the list, you can identify the places where the connections occur, i.e places
where there is a jump from one point to the next in either the x or y value. So if you
can find those places and break up the line at those places, the connections will be
dropped. One way to do that is to use loops.
In[119]:= i=1;
ptsList={};
linesList={};While[i<= Length[pts]-1,
While[(Abs[pts[[i, 1]]-pts[[i+1, 1]]]<6) && (Abs[pts[[i, 2]]-pts[[i+1, 2]]]<
6) &&(i< Length[pts]-1),(AppendTo[ptsList, pts[[i]]]; i = i + 1);
];
AppendTo[linesList,Line[ptsList]];
i=i+1;
ptsList={};
]
linesList will contain a list of lines that avoid the jumps. I did not look hard at the result
to see if any points were dropped.
The you can use Show to see the graph.
In[123]:= Show[Graphics[linesList],Axes->True, AspectRatio->1]
URL: , |
|