Can the length of the example line in the legend be changed? I’m particularly interested in pyplot()
.
You may need to use PyPlot directly:
using PyPlot()
f = [cos, sin, tan, exp, log, atan]
lw = [3, 2, 1, 1, 3, 2] # line width
ls = ["solid", "solid", "solid", "dashed", "dashed","dotted"] #line_style
x = 0.2 : 0.01: 1.2
fig, ax = PyPlot.plt.subplots()
[ax.plot(x, f.(x), lw=lw, ls=ls, label="$(f)") for (f,lw,ls) in zip(f,lw,ls)]
ax.legend(loc="upper left", fontsize=8)
ax.grid(linestyle=:dotted, color="gray")
PyPlot.plt.ylim(-2, 4)
PyPlot.plt.xlim(extrema(x))
PyPlot.plt.legend(handlelength=8) # legend line length
fig.show()
1 Like