Message Boards Message Boards

0
|
6549 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to place legend inside a plot?

Posted 3 years ago

Kindly let me know as how to place the legend in the following code, to be placed inside the plot. In my case presently it is placed outside the plot.

y = Range[1, 10];
x = Range[1, 10];
visco = 12*10^-6;
x = (-p11*(1/xi + I k) - p44*(1/xi + I k)*(I k - 1/xi) + 
     p66*(1/xi^2 + k^2) +  y*(q22*(1/xi + I k) - q33*(1/xi + I k) (I k - 1/xi) - 
        q44*(1/xi^2 + k^2) - q55*(1/xi - I k)))/(p22 + 
     p33*(I k - 1/xi) - p55*(1/xi^2 + k^2));
x = x*10^-25;
Plot[{Re[x] /. {xi -> 10}, Re[x] /. xi -> 50, Re[x] /. xi -> 100}, {k,
   0, 100}, PlotRange -> All, 
 PlotStyle -> {Directive[Red, Thick], Directive[Blue, Dashed, Thick], 
   Directive[Black, Thick, Dashed]}, Frame -> True, 
 FrameStyle -> Directive[Black, Thickness@0.0125], 
 PlotLegends -> {Style["\[Xi] = 10", Bold, 14], 
   Style["\[Xi] = 50", Bold, 14], Style["\[Xi] = 100", Bold, 14]}, 
 FrameLabel -> {"K", "\!\(\*SubscriptBox[\(\[CapitalOmega]\), \(r\)]\)"}, 
 LabelStyle -> Directive[Black, Bold, 14], RotateLabel -> True, 
 AspectRatio -> 0.5]
POSTED BY: Rahul Chakrabory
3 Replies
Posted 3 years ago

Hi Rahul,

You did not specify where inside the plot, you can adjust that

PlotLegends -> 
 Placed[LineLegend[{Style["\[Xi] = 10", Bold, 14], 
    Style["\[Xi] = 50", Bold, 14], Style["\[Xi] = 100", Bold, 14]}, 
    LegendFunction -> Frame, LegendLayout -> "Row"], {Center, Top}]
POSTED BY: Rohit Namjoshi

Thanks, Kindly tell me how to remove the legend border?

POSTED BY: Rahul Chakrabory
Posted 3 years ago

Remove LegendFunction -> Frame. Check the documentation for other options.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract