1
$\begingroup$

I cannot find how to plot the branches of a 'ParametricPlot' in different colors

x[a_] := 8*(6 + a)/(16 - a^2);
y[a_] := 2*(8 + 3 a)/(16 - a^2);
pl1 = ParametricPlot[{x[a], y[a]}, {a, -40, -4}, PlotStyle -> Red]
pl2 = ParametricPlot[{x[a], y[a]}, {a, -4, 4}, PlotStyle -> Green]
pl3 = ParametricPlot[{x[a], y[a]}, {a, 4, 12}, PlotStyle -> Black]
Show[pl1, pl2, pl3]
$\endgroup$
0
1
$\begingroup$

Set Mesh->{{-4,4}}.( The default MeshFunctions->{#3&})

x[a_] = 8*(6 + a)/(16 - a^2);
y[a_] = 2*(8 + 3 a)/(16 - a^2);
ParametricPlot[{x[a], y[a]}, {a, -40, 12}, 
 MeshShading -> {Red, Green, Black}, 
 Mesh -> {{-4, 4}},PlotRange -> 10,(* MeshFunctions->{#3&}*)]

enter image description here

$\endgroup$
2
$\begingroup$

Add the PlotRange option to your Show statement, like this:

Show[{pl1, pl2, pl3}, PlotRange -> {{-8, 8}, {-5, 5}}]

We might ask what happens at $a=-4$? Why don't the three lines intersect at this point? Use Manipulate to see why:

Manipulate[
 Show[{pl1, pl2 , pl3,
   Graphics[{PointSize[.02], Cyan, Point[{x[a], y[a]}]}]},
  PlotRange -> {{-8, 8}, {-5, 5}}],
 {a, -10, 10}]
$\endgroup$
1
  • $\begingroup$ Indeed the manipulate helps understand parametric curves with several branches, Thanks! $\endgroup$
    – florin
    Nov 28 '21 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.