# Use ContourPlot data in ParametricPlot

Let me give an example,

probe1 = ContourPlot[10 == x + y, {x, 0, 10}, {y, 0, 10}, Frame -> True, FrameLabel -> {"x", "y"}]


This plots 10=f[x,y]=x+y, for a set of point (x,y) that solved the equality. Moreover,

probe2 = ParametricPlot[{x y, x^2 + y^2}, {x, 0, 10}, {y, 0, 10}]


where g=g[x,y]=xy and h=h[x,y]=x^2+y^2, plots h=h[g[x,y]]. What I want is to plot only the case in which x+y=10. What should I do?

• How about a parametric region Region[ParametricRegion[{{x y, x^2 + y^2}, x + y == 10}, {{x, 0, 10}, {y, 0, 10}}], Frame -> True] – Simon Woods Jul 5 '19 at 21:02

Update: Adding multiple mesh lines and legends:

mesh = {{9, Directive[Red, Opacity, Thick]},
{10, Directive[Green, Opacity, Thick]},
{12, Directive[Black, Opacity, Thick]}};

ParametricPlot[{u t, u^2 + t^2}, {u, 0, 10}, {t, 0, 10},
MeshFunctions -> {Function[{x, y, u, t}, u + t]},
Mesh -> {mesh},
PlotLegends -> LineLegend[## & @@ Reverse[Transpose[mesh]], LegendLabel -> "u + t"]] You can use the argument of ContourPlot as the MeshFunctions option value in ParametricPlot as follows:

ParametricPlot[{u t, u^2 + t^2}, {u, 0, 10}, {t, 0, 10},
MeshFunctions -> {Function[{x, y, u, t}, u + t - 10]},
Mesh -> {{0}},
MeshStyle -> Directive[Red, Thick]] • It worked. Thanks. Do you have a sugestion to include in the same ParametricPlot several cases of the condition, for example u+v-2 and u+v-5, etc? What should I change in your solution? – Patrick El Pollo Jul 6 '19 at 3:49
• @PatrickElPollo, try ParametricPlot[{u t, u^2 + t^2}, {u, 0, 10}, {t, 0, 10}, MeshFunctions -> {Function[{x, y, u, t}, u + t]}, Mesh -> {{{9, Directive[Red, Opacity, Thick]}, {10, Directive[Green, Opacity, Thick]}, {12, Directive[Black, Opacity, Thick]}}}] – kglr Jul 6 '19 at 4:03
• thanks, again. Only one more detail, sorry... is it possible to label each Mesh to have a legend of them? – Patrick El Pollo Jul 6 '19 at 4:27
• Patrick, please see the update. – kglr Jul 6 '19 at 5:12
• @PatrickElPollo, you can use PlotStyle -> White (but that also gets rid of the right boundary) – kglr Jul 14 '19 at 23:56

This may be what you want

Clear["Global*"]

eqn = 10 == x + y;

ysol[x_] = y /. Solve[eqn, y][]

(* 10 - x *)

Show[
ParametricPlot[
{x y, x^2 + y^2},
{x, 0, 10}, {y, 0, 10}],
ParametricPlot[
Evaluate[{x y, x^2 + y^2} /. y -> ysol[x]],
{x, 0, 10},
PlotStyle -> Red]] • it works, but what I want is a way to extract the pairs from ContourPlot when Solve does not work to use them as parameters in ParametricPlot. – Patrick El Pollo Jul 5 '19 at 19:39
• @PatrickElPollo - have you tried using a numeric solver such as NSolve or FindRoot`? – Bob Hanlon Jul 5 '19 at 23:29