Merge pull request #1251 from daschw/pyplot-legend
PyPlot: change legend symbols for shapes and filled plots
This commit is contained in:
commit
892d68e792
@ -2,7 +2,7 @@
|
|||||||
# https://github.com/stevengj/PyPlot.jl
|
# https://github.com/stevengj/PyPlot.jl
|
||||||
|
|
||||||
@require Revise begin
|
@require Revise begin
|
||||||
Revise.track(Plots, joinpath(Pkg.dir("Plots"), "src", "backends", "pyplot.jl"))
|
Revise.track(Plots, joinpath(Pkg.dir("Plots"), "src", "backends", "pyplot.jl"))
|
||||||
end
|
end
|
||||||
|
|
||||||
const _pyplot_attr = merge_with_base_supported([
|
const _pyplot_attr = merge_with_base_supported([
|
||||||
@ -1009,7 +1009,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
for lab in cb[:ax][:yaxis][:get_ticklabels]()
|
for lab in cb[:ax][:yaxis][:get_ticklabels]()
|
||||||
lab[:set_fontsize](py_dpi_scale(plt, sp[:yaxis][:tickfont].pointsize))
|
lab[:set_fontsize](py_dpi_scale(plt, sp[:yaxis][:tickfont].pointsize))
|
||||||
lab[:set_family](sp[:yaxis][:tickfont].family)
|
lab[:set_family](sp[:yaxis][:tickfont].family)
|
||||||
end
|
end
|
||||||
sp.attr[:cbar_handle] = cb
|
sp.attr[:cbar_handle] = cb
|
||||||
sp.attr[:cbar_ax] = cbax
|
sp.attr[:cbar_ax] = cbax
|
||||||
end
|
end
|
||||||
@ -1221,15 +1221,16 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
|||||||
for series in series_list(sp)
|
for series in series_list(sp)
|
||||||
if should_add_to_legend(series)
|
if should_add_to_legend(series)
|
||||||
# add a line/marker and a label
|
# add a line/marker and a label
|
||||||
push!(handles, if series[:seriestype] == :shape
|
push!(handles, if series[:seriestype] == :shape || series[:fillrange] != nothing
|
||||||
PyPlot.plt[:Line2D]((0,1),(0,0),
|
pypatches[:Patch](
|
||||||
color = py_color(_cycle(series[:fillcolor],1)),
|
edgecolor = py_color(_cycle(series[:linecolor],1)),
|
||||||
linewidth = py_dpi_scale(plt, 4)
|
facecolor = py_color(_cycle(series[:fillcolor],1)),
|
||||||
|
linewidth = py_dpi_scale(plt, clamp(series[:linewidth], 0, 5)),
|
||||||
)
|
)
|
||||||
elseif series[:seriestype] == :path
|
elseif series[:seriestype] == :path
|
||||||
PyPlot.plt[:Line2D]((0,1),(0,0),
|
PyPlot.plt[:Line2D]((0,1),(0,0),
|
||||||
color = py_color(_cycle(series[:fillcolor],1)),
|
color = py_color(_cycle(series[:fillcolor],1)),
|
||||||
linewidth = py_dpi_scale(plt, 1),
|
linewidth = py_dpi_scale(plt, clamp(series[:linewidth], 0, 5)),
|
||||||
marker = py_marker(series[:markershape]),
|
marker = py_marker(series[:markershape]),
|
||||||
markeredgecolor = py_markerstrokecolor(series),
|
markeredgecolor = py_markerstrokecolor(series),
|
||||||
markerfacecolor = py_markercolor(series)
|
markerfacecolor = py_markercolor(series)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user