# Legend covers the yaxis

**URL:** <https://discourse.julialang.org/t/legend-covers-the-yaxis/122334>\
**Category:** Visualization\
**Tags:** plotting, plots, plotlyjs\
**Created:** [November 6, 2024, 1:27pm UTC](https://discourse.julialang.org/t/legend-covers-the-yaxis/122334 "2024-11-06T13:27:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Post date:** [November 6, 2024, 1:27pm UTC](https://discourse.julialang.org/t/legend-covers-the-yaxis/122334/1 "2024-11-06T13:27:09Z")

</div>

![屏幕截图_20241106_212119](https://global.discourse-cdn.com/julialang/original/3X/f/9/f95d59acd6755a4cb6b1c4a3df3355d95c633e9e.png)

```julia
using Plots

plotlyjs()

plot!(
    M2, x_台湾, 货币_台湾.M2./货币_台湾.全體銀行放款餘額,
    
    label = "M2/全体银行放款余额", 
    
    fg_legend = :transparent, 
    
    legend = :bottomleft,
    
    tickfontsize = 11, 

    xticks = xticks,

    legend_font_pointsize = 10
)

```

why couldn’t specify the legend to a custom position in plots?

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [November 7, 2024, 12:57am UTC](https://discourse.julialang.org/t/legend-covers-the-yaxis/122334/2 "2024-11-07T00:57:13Z")

</div>

The `legend` or `legend_position` attribute is described here:

> Show the legend ?  
> Can also be a (x,y) tuple or Symbol (legend position) or angle (angle,inout) tuple.  
> Bottom left corner of legend is placed at (x,y).  
> Choose from (`:none`, `:best`, `:inline`, `:inside`, `:legend`) or any valid combination of `:(outer ?)(top/bottom ?)(right/left ?)`,  
> i.e.: `:top`, `:topright`, `:outerleft`, `:outerbottomright` …  
> (note: only some may be supported in each backend).

on the page [Subplot Attributes · Plots](https://docs.juliaplots.org/stable/generated/attributes_subplot/)

However, if this attribute is not supported for the `plotlyjs` backend in `Plots.jl`, to get full control of the legend position you may need to use `PlotlyJS.jl` and use layout settings, for example, [Layout in Julia](https://plotly.com/julia/reference/layout/#layout-legend-x)

---

<div class="post-metadata">

**Author:** ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Post date:** [November 7, 2024, 1:23am UTC](https://discourse.julialang.org/t/legend-covers-the-yaxis/122334/3 "2024-11-07T01:23:53Z")

</div>

> [@jd-foster](#):
>
> Can also be a (x,y) tuple

```julia
legend_position = (x, y)

```

works fine, Thank you !
