adjust pyplot to master

This commit is contained in:
Simon Christ 2021-10-20 12:00:26 +02:00
parent 49d5489e96
commit 01253b97fb

View File

@ -1607,20 +1607,10 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
linestyle = py_linestyle(series[:seriestype], ls), linestyle = py_linestyle(series[:seriestype], ls),
capstyle = "butt", capstyle = "butt",
) )
elseif series[:seriestype] in (:path, :straightline, :scatter, :steppre, :stepmid, :steppost)
hasline = get_linewidth(series) > 0 # plot two handles on top of each other by passing in a tuple
PyPlot.plt."Line2D"((0, 1),(0,0), # https://matplotlib.org/stable/tutorials/intermediate/legend_guide.html
color = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)), push!(handles, (line_handle, fill_handle))
linewidth = py_thickness_scale(plt, hasline * sp[:legend_font_pointsize] / 8),
linestyle = py_linestyle(:path, get_linestyle(series)),
solid_capstyle = "butt", solid_joinstyle = "miter",
dash_capstyle = "butt", dash_joinstyle = "miter",
marker = py_marker(_cycle(series[:markershape], 1)),
markersize = py_thickness_scale(plt, 0.8 * sp[:legend_font_pointsize]),
markeredgecolor = py_color(single_color(get_markerstrokecolor(series)), get_markerstrokealpha(series)),
markerfacecolor = py_color(single_color(get_markercolor(series, clims)), get_markeralpha(series)),
markeredgewidth = py_thickness_scale(plt, 0.8 * get_markerstrokewidth(series) * sp[:legend_font_pointsize] / first(series[:markersize])) # retain the markersize/markerstroke ratio from the markers on the plot
)
else else
# plot line handle (which includes solid fill) only # plot line handle (which includes solid fill) only
push!(handles, line_handle) push!(handles, line_handle)