4
$\begingroup$

I have the following code

 ParametricPlot[{{8 Cos[θ], 8 Sin[θ]}, 
                {7.7 Cos[θ],7.7 Sin[θ]}, 
                {7 Cos[θ], 7 Sin[θ]}, 
                {6.5 Cos[θ], 6.5 Sin[θ]},
                {6 Cos[θ], 6 Sin[θ]}},
               {θ, -5, 5}, 
Frame -> True, PlotRange -> {{-10, 10}, {-10, 10}}, PlotStyle -> {{Thin, Red}, 
{Dashed, Blue}, {Dashed, Green}, {Dashed, Purple}, {Dashed, Black}}]

How to add label to each curve and text in the middle saying $a=0.3$ so the plot looks like

enter image description here

$\endgroup$

2 Answers 2

7
$\begingroup$
ParametricPlot[{{8 Cos[θ], 
   8 Sin[θ]}, {7.7 Cos[θ], 
   7.7 Sin[θ]}, {7 Cos[θ], 
   7 Sin[θ]}, {6.5 Cos[θ], 
   6.5 Sin[θ]}, {6 Cos[θ], 
   6 Sin[θ]}}, {θ, -Pi, Pi}, Frame -> True, 
 PlotRange -> {{-10, 10}, {-10, 10}}, 
 PlotStyle -> {Directive[Red, Thickness[Large]], 
   Directive[Blue, Dashed, Thickness[Large]], 
   Directive[Green, Dashed, Thickness[Large]], 
   Directive[Purple, Dashed, Thickness[Large]], 
   Directive[Black, Dashed, Thickness[Large]]}, 
 Epilog -> {Text[Framed[Style["a=0.3", 20, Blue]], 
    Scaled[{0.6, 0.4}]]}, 
 PlotLegends -> 
  Placed[LineLegend[{Directive[Red, Thickness[Large]], 
     Directive[Blue, Dashed, Thickness[Large]], 
     Directive[Green, Dashed, Thickness[Large]], 
     Directive[Purple, Dashed, Thickness[Large]], 
     Directive[Black, Dashed, Thickness[Large]]}, {"k=0.0", "k=0.1", 
     "k=0.2", "k=0.3", "k=0.4"}], {0.6, 0.6}]]

enter image description here

$\endgroup$
2
  • $\begingroup$ Is there a way to add White box with black border around $a=0.3$? $\endgroup$
    – gbd
    Feb 17, 2017 at 10:01
  • $\begingroup$ @gbd see the edit $\endgroup$
    – zhk
    Feb 17, 2017 at 10:05
4
$\begingroup$

Building on MMM's code I would use Dashing to dial in that part, and use Automatic in LineLegend to carry over those specifications.

ParametricPlot[{{8 Cos[θ], 8 Sin[θ]}, {7.7 Cos[θ], 
   7.7 Sin[θ]}, {7 Cos[θ], 7 Sin[θ]}, {6.5 Cos[θ], 
   6.5 Sin[θ]}, {6 Cos[θ], 6 Sin[θ]}},
 {θ, -Pi, Pi}, 
 Frame -> True,
 PlotRange -> {{-9, 9}, {-9, 9}}, 
 PlotStyle -> {
   Directive[Red, AbsoluteThickness[3]], 
   Directive[Blue, Dashing[{.03, .02}], AbsoluteThickness[3]], 
   Directive[Green, Dashing[{.02, .01}], AbsoluteThickness[3]], 
   Directive[Purple, Dashing[{.012, .003}], AbsoluteThickness[3]], 
   Directive[Black, Dashing[{.014, .002}], AbsoluteThickness[3]]
  }, 
 Epilog -> {Text[Framed[Style["a=0.3", 20, Blue]], Scaled[{0.6, 0.4}]]}, 
 PlotLegends -> 
  Placed[
    LineLegend[Automatic, {"k=0.0", "k=0.1", "k=0.2", "k=0.3", "k=0.4"}],
    {0.61, 0.62}
  ]
]

enter image description here

$\endgroup$
1
  • $\begingroup$ I didn't knew that we can pass on a number to AbsoluteThickness. $\endgroup$
    – zhk
    Feb 17, 2017 at 11:05

Your Answer

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

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