3
$\begingroup$

I whis to make that my labels are inside of the frame, as is shown in the following figure: whatIwish

How can I do it? The best that I did is with the following code:

Plot[{Sin[x], Cos[x]}, {x, 0, 28.27]}, Frame -> True, 
 PlotRange -> {-1.5, 1.5}, 
 PlotLegends -> Placed["Expressions", {Below, Center}]]

WhatIobtain

Thanks for your help!

$\endgroup$

2 Answers 2

10
$\begingroup$

You can also use the symbolic position {Center, Bottom} but it gives a column layout for the legends:

 Plot[{Sin[x], Cos[x]}, {x, 0, 28.27}, Frame -> True, 
    PlotRange -> {-1.5, 1.5}, 
    PlotLegends -> Placed["Expressions", {Center, Bottom}]] 

enter image description here

which is easily modified with a simple replacement:

 % /. "Column" -> "Row" 

enter image description here

$\endgroup$
5
$\begingroup$
Plot[{Sin[x], Cos[x]}, {x, 0, 28.27}, Frame -> True, 
 PlotRange -> {-1.5, 1.5}, 
 PlotLegends -> Placed["Expressions", {{.5, 0}, {.5, -.5}}]]

enter image description here

$\endgroup$
1
  • $\begingroup$ Use the approach by @kglr Plot[{Sin[x], Cos[x]}, {x, 0, 28.27}, Frame -> True, PlotRange -> {-1.5, 1.5}, PlotLegends -> Placed[LineLegend["Expressions", LegendLayout -> "Row"], {Center, Bottom}]] $\endgroup$
    – cvgmt
    Commented Jul 9, 2021 at 1:57

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.