Legend covers the yaxis

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?

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

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

2 Likes
legend_position = (x, y)

works fine, Thank you !

1 Like