1
$\begingroup$

I want to PlotLegends -> "Expressions" for G with different colors where

G = {{Sqrt[1 - x] + I Sqrt[x]}, {Sqrt[1 - x] - I Sqrt[x]}}

I tried the following

ParametricPlot[{Re[#], Im[#]} & /@ G , {x, 0, 1}, PlotRange -> {{-1, 1}, {-1, 1}}, PlotLegends -> "Expressions"]

This gives

enter image description here

while G1=Sqrt[1 - x] + I Sqrt[x], G2=Sqrt[1 - x] + I Sqrt[x] .Thus G={{G1},{G2}} and for G1, I got

ParametricPlot[{Re[G1], Im[G1]} , {x, 0, 1}, PlotRange -> {{-1, 1}, {-1, 1}}, PlotLegends -> "Expressions"]

enter image description here

and for G2, I got

ParametricPlot[{Re[G2], Im[G2]}, {x, 0, 1}, PlotRange -> {{-1, 1}, {-1, 1}}, PlotLegends -> "Expressions"]

enter image description here

Thanks in advance..

$\endgroup$
1
$\begingroup$

The list of functions should be a simple List

G = {Sqrt[1 - x] + I Sqrt[x], Sqrt[1 - x] - I Sqrt[x]};

Use ReIm and since ParametricPlot has the attribute HoldAll, use Evaluate

ParametricPlot[Evaluate[ReIm /@ G], {x, 0, 1},
 AxesLabel -> (Style[#, 12, Bold] & /@ {Re, Im}),
 PlotRange -> {{-1, 1}, {-1, 1}},
 PlotLegends -> Placed[G, {0.7, 0.65}]]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you, you got it. $\endgroup$ – M. H. Jan 14 at 23:02
0
$\begingroup$

H. The problem with coloring is usually solved by evaluating the expression passed as an argument before drawing. In your case however you'll need to also extract or flatten your list of lists.

So either try this:

ParametricPlot[Evaluate[{Re[First@#], Im[First@#]} & /@ G], {x, 0, 1}, PlotRange -> {{-1, 1}, {-1, 1}}, PlotLegends -> "Expressions"]

or this:

ParametricPlot[Evaluate[{Re[#], Im[#]} & /@ Flatten@G], {x, 0, 1}, PlotRange -> {{-1, 1}, {-1, 1}}, PlotLegends -> "Expressions"]
$\endgroup$
  • $\begingroup$ I run these and I got the Expressions but with empty curves on complex plane.. $\endgroup$ – M. H. Jan 14 at 22:56
  • $\begingroup$ You must have used a different G, with G = {{Sqrt[1 - x] + I Sqrt[x]}, {Sqrt[1 - x] - I Sqrt[x]}} I get exactly the same result as the second answer you've got. $\endgroup$ – Ranza Jan 14 at 23:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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