0
$\begingroup$

The Placed function can put a legend on a Plot, but the position will be changed when I change the ImageSize.

Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, Frame -> True, Axes -> False, PlotRangeClipping -> False, PlotLegends -> Placed["Expressions", {0.1, 0.9}], ImageSize -> Medium] 

Is there a way to fix the legend position by giving coordinates? For example, let the legend left-top corner fix at point (1,1), or let the spacings between the legend and frame be 0.1 image width and 0.1 height.

enter image description here

$\endgroup$
1
  • $\begingroup$ Have you seen Scaled ? $\endgroup$ Commented Nov 1, 2022 at 20:13

1 Answer 1

0
$\begingroup$

I found a way that uses the Scaled function.

Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, Frame -> True, Axes -> False, PlotRangeClipping -> False, PlotLegends -> Placed["Expressions", {Scaled[{0.1, 0.9}], {0, 1}}], AspectRatio -> 1] 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.