4

I have a legend in my pgfplots and want to manually position it at a point where the legend does not cover any text or measurement points.

I know the axis property legend pos=north west, but it's not possible to position it at a custom location. According to the documentation (link) only the following values are allowed:

/pgfplots/legend pos=south west|south east|north west|north east|outer north east

A style which provides shorthand access to some commonly used legend positions.

How can I move the legend so that it is at the right position in my plot? enter image description here Thank you very much for your help!

4

You can try writing something like this in axis

\begin{axis}[
...
legend style={at={(0.2,0.5)},anchor=north west},
...
]

You can change the coordinate value to match the requirement.

at={(0,0)} will draw it at the lower left corner of the axis and
at={(1,1)} will draw it at the top right corner of the axis.

  • Yeah very nice, thanks a lot! – Sim Mar 22 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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