[pyplot] marker adjustments

This commit is contained in:
Zh 2020-04-18 14:20:24 +09:00
parent fae1cb4884
commit 43456b09f6

View File

@ -1303,7 +1303,8 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
if should_add_to_legend(series) if should_add_to_legend(series)
clims = get_clims(sp, series) clims = get_clims(sp, series)
# add a line/marker and a label # add a line/marker and a label
push!(handles, if series[:seriestype] == :shape || series[:fillrange] !== nothing push!(handles,
if series[:seriestype] == :shape || series[:fillrange] !== nothing
pypatches."Patch"( pypatches."Patch"(
edgecolor = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)), edgecolor = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)),
facecolor = py_color(single_color(get_fillcolor(series, clims)), get_fillalpha(series)), facecolor = py_color(single_color(get_fillcolor(series, clims)), get_fillalpha(series)),
@ -1315,13 +1316,16 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
color = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)), color = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)),
linewidth = py_thickness_scale(plt, clamp(get_linewidth(series), 0, 5)), linewidth = py_thickness_scale(plt, clamp(get_linewidth(series), 0, 5)),
linestyle = py_linestyle(:path, get_linestyle(series)), linestyle = py_linestyle(:path, get_linestyle(series)),
marker = py_marker(_cycle(series[:markershape], 1)), # Need to adjust markersize to match the legend box size marker = py_marker(_cycle(series[:markershape], 1)),
# markersize = py_thickness_scale(plt, series[:markersize]), # In case we decide that markersize needs to be scaled in the legend too
markeredgecolor = py_color(single_color(get_markerstrokecolor(series)), get_markerstrokealpha(series)), markeredgecolor = py_color(single_color(get_markerstrokecolor(series)), get_markerstrokealpha(series)),
markerfacecolor = py_color(single_color(get_markercolor(series, clims)), get_markeralpha(series)) markerfacecolor = py_color(single_color(get_markercolor(series, clims)), get_markeralpha(series)),
markeredgewidth = py_thickness_scale(plt, series[:markerstrokewidth])
) )
else else
series[:serieshandle][1] series[:serieshandle][1]
end) end
)
push!(labels, series[:label]) push!(labels, series[:label])
end end
end end