# Location of the legend in PyPlot

**URL:** <https://discourse.julialang.org/t/location-of-the-legend-in-pyplot/1311>\
**Category:** New to Julia\
**Tags:** question, pyplot\
**Created:** [January 5, 2017, 6:42pm UTC](https://discourse.julialang.org/t/location-of-the-legend-in-pyplot/1311 "2017-01-05T18:42:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Daneel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daneel/32/175_2.png) [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Post date:** [January 6, 2017, 7:57am UTC](https://discourse.julialang.org/t/location-of-the-legend-in-pyplot/1311/2 "2017-01-06T07:57:10Z")

</div>

It doesn’t automatically adjust the axis dimensions unfortunately.

```julia
x = 0:0.1:3*pi
y = sin(x)
z = cos(x)
ax = axes()
plot(x,y,label="sin(x)")
plot(x,z,label="cos(x)")
grid("on")
legend(bbox_to_anchor=[1.05,1],loc=2,borderaxespad=0)
ax[:set_position]([0.06,0.06,0.71,0.91])

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/3/7/37edf0a9fec3411af09f6ce45e1bbe8d30fe2fbe.png)

---

_[View the full topic](https://discourse.julialang.org/t/location-of-the-legend-in-pyplot/1311)._
