3
$\begingroup$

I am trying to plot this diagram, distinguished into three separate regions by the white curve. The code that I used for this purpose is provided below:

r[x_] = (-1 + 5 x^4)/(4 x^5); s[x_] = (-1 + 3 x^4)/(2 x^6);
bg = Polygon[{ImageScaled[{0, 0}], ImageScaled[{0.5, 0}], 
    ImageScaled[{1, 0}], ImageScaled[{1, 1}], ImageScaled[{0.78, 1}], 
    ImageScaled[{0, 1}]}, 
   VertexColors -> {Green, Red, Blue, Blue, Red, Green}];
p0 = ParametricPlot[{r[x], s[x]}, {x, -100, 100}, 
  PlotRange -> {{0.0, 1.5}, {0.0, 1.5}}, AspectRatio -> 0.5, 
  PlotTheme -> "Scientific", PlotStyle -> {White, Thick},
  Epilog -> {{{Blue, Disk[{1, 1}, {0.03, 0.035}, {0, 2 Pi/3}]}, {Red, 
      Disk[{1, 1}, {0.03, 0.035}, {2 Pi/3, 4 Pi/3}]}, {Green, 
      Disk[{1, 1}, {0.03, 0.035}, {4 Pi/3, 2 \[Pi]}]}}, {PointSize[
      0.03], Darker[Blue], Point[{0.1, 1}], Darker[Red], 
     Point[{0.7, 0.3}], Darker[Green], Point[{1.4, 1}]}},
  Prolog -> {Rotate[bg, 180*Degree], {GrayLevel[0.9], Dotted, 
     Line[{{0, 1}, {1, 1}}], InfiniteLine[{{1, 0}, {1, 1}}], 
     InfiniteLine[{{0.66, 0}, {0.66, 1}}]}}]

which gives me the following result:

phase diagram

As you can see from the figure, the red-coloured region spreads away because of my choice of Polygon. I wish to restrict the red-coloured region in between the white curve. What modification should I make in my original code to achieve this?

$\endgroup$

2 Answers 2

1
$\begingroup$

The given functions are

r[x_] = (-1 + 5 x^4)/(4 x^5); s[x_] = (-1 + 3 x^4)/(2 x^6);

Backgrounds

bg1 = Polygon[{{0.1, 0}, {0, 0}, {1.5, 0}, {1.5, 1.5}, {1.1, 1.5}, {0,
      1.5}}, VertexColors -> {Lighter[Green, 0.00], Green, Blue, Blue,
      Red, Green}];
bg2 = Polygon[{{0, 0}, {0, 1.5}, {1.5, 1.5}, {1.5, 0}}, 
   VertexColors -> {Green, Blue, Blue, Lighter[Green, 0.2]}];

The required plot

ParametricPlot[{r[x], s[x]}, {x, -100, 100}, 
  PlotRange -> {{0.0, 1.5}, {0.0, 1.5}}, AspectRatio -> 0.5, 
  PlotTheme -> "Scientific", ImageSize -> 1800, 
  LabelStyle -> {44, Black}, PlotStyle -> {White, Thick},
 
  Prolog -> {Rotate[bg2, 90*Degree], Rotate[bg1, 180*Degree],
{GrayLevel[0.9], Dotted, Line[{{0, 1}, {1, 1}}], 
     InfiniteLine[{{1, 0}, {1, 1}}], 
     InfiniteLine[{{0.66, 0}, {0.66, 1}}]}}]

enter image description here

I could not find another way to do it. Therefore, I used two background polygons, one over another. I hope this suffices your needs.

$\endgroup$
2
$\begingroup$

You can (1) replace Red with Blue in definition of bg and (2) post-process ParametricPlot output to add a FilledCurve with desired style:

r[x_] = (-1 + 5 x^4)/(4 x^5); s[x_] = (-1 + 3 x^4)/(2 x^6);

bg = Polygon[{ImageScaled[{0, 0}], ImageScaled[{0.5, 0}], 
    ImageScaled[{1, 0}], ImageScaled[{1, 1}], ImageScaled[{0.78, 1}], 
    ImageScaled[{0, 1}]}, 
   VertexColors -> {Green, Blue, Blue, Blue, Blue, Green}];

epilog = {{{Blue, Disk[{1, 1}, {0.03, 0.035}, {0, 2 Pi/3}]}, 
  {Red, Disk[{1, 1}, {0.03, 0.035}, {2 Pi/3, 4 Pi/3}]},
  {Green, Disk[{1, 1}, {0.03, 0.035}, {4 Pi/3, 2 \[Pi]}]}}, 
  {PointSize[0.03], Darker[Blue], Point[{0.1, 1}], Darker[Red], 
   Point[{0.7, 0.3}], Darker[Green], Point[{1.4, 1}]}};

prolog = {Rotate[bg, 180*Degree], {GrayLevel[0.9], Dotted, 
    Line[{{0, 1}, {1, 1}}], InfiniteLine[{{1, 0}, {1, 1}}], 
    InfiniteLine[{{0.66, 0}, {0.66, 1}}]}};

pp = ParametricPlot[{ r[x], s[x]}, {x, -100, 100}, 
  PlotRange -> {{0.0, 1.5}, {0.0, 1.5}}, AspectRatio -> 0.5, 
  PlotTheme -> "Scientific", PlotStyle -> {White, Thick}, 
  DisplayFunction -> 
   ReplaceAll[l_Line :> {Red, Opacity[1], FilledCurve[l], White, l}]]

enter image description here

Show[pp, Epilog -> epilog, Prolog -> prolog]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you for the response! Actually I don't wish a solid Filled curve in my plot. I wish to get a gradient like feel just like in the blue and green regions, basically I wish the colours to mix as well. Any other way I can make it happen without using a filled curve? I hope you understand the idea. $\endgroup$
    – codebpr
    Commented Sep 21, 2023 at 16:45
  • 1
    $\begingroup$ @codebpr, I can't think of a way to mix colors. I will post an update if I find a way. $\endgroup$
    – kglr
    Commented Sep 21, 2023 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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