From 01253b97fb4de4276453fc08d8efbab0fa9ca231 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Wed, 20 Oct 2021 12:00:26 +0200 Subject: [PATCH] adjust pyplot to master --- src/backends/pyplot.jl | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 36c9b69f..0800ef8b 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1607,20 +1607,10 @@ function py_add_legend(plt::Plot, sp::Subplot, ax) linestyle = py_linestyle(series[:seriestype], ls), capstyle = "butt", ) - elseif series[:seriestype] in (:path, :straightline, :scatter, :steppre, :stepmid, :steppost) - hasline = get_linewidth(series) > 0 - PyPlot.plt."Line2D"((0, 1),(0,0), - color = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)), - 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 - ) + + # plot two handles on top of each other by passing in a tuple + # https://matplotlib.org/stable/tutorials/intermediate/legend_guide.html + push!(handles, (line_handle, fill_handle)) else # plot line handle (which includes solid fill) only push!(handles, line_handle)