Allow legend for surfaces (#2439)
* allow legends for surfaces * remove unnecessary checks * redo necessary checks
This commit is contained in:
parent
6da5bb8822
commit
d5788fc1e7
@ -292,7 +292,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
if sf isa Number || sf isa AVec
|
if sf isa Number || sf isa AVec
|
||||||
pgfx_fillrange_series!( axis, series, series_func, i, _cycle(sf, rng), rng)
|
pgfx_fillrange_series!( axis, series, series_func, i, _cycle(sf, rng), rng)
|
||||||
end
|
end
|
||||||
if i == 1 && opt[:label] != "" && sp[:legend] != :none && should_add_to_legend(series)
|
if i == 1 && sp[:legend] != :none && pgfx_should_add_to_legend(series)
|
||||||
pgfx_filllegend!(series_opt, opt)
|
pgfx_filllegend!(series_opt, opt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -331,9 +331,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
# add to legend?
|
# add to legend?
|
||||||
if i == 1 &&
|
if i == 1 && sp[:legend] != :none && pgfx_should_add_to_legend(series)
|
||||||
opt[:label] != "" &&
|
|
||||||
sp[:legend] != :none && should_add_to_legend(series)
|
|
||||||
leg_opt = PGFPlotsX.Options()
|
leg_opt = PGFPlotsX.Options()
|
||||||
if ribbon !== nothing
|
if ribbon !== nothing
|
||||||
pgfx_filllegend!(axis.contents[end-3].options, opt)
|
pgfx_filllegend!(axis.contents[end-3].options, opt)
|
||||||
@ -678,6 +676,25 @@ function pgfx_font(fontsize, thickness_scaling = 1, font = "\\selectfont")
|
|||||||
return string("{\\fontsize{", fs, " pt}{", 1.3fs, " pt}", font, "}")
|
return string("{\\fontsize{", fs, " pt}{", 1.3fs, " pt}", font, "}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function pgfx_should_add_to_legend(series::Series)
|
||||||
|
series.plotattributes[:primary] && series.plotattributes[:label] != "" &&
|
||||||
|
!(
|
||||||
|
series.plotattributes[:seriestype] in (
|
||||||
|
:hexbin,
|
||||||
|
:bins2d,
|
||||||
|
:histogram2d,
|
||||||
|
:hline,
|
||||||
|
:vline,
|
||||||
|
:contour,
|
||||||
|
:contourf,
|
||||||
|
:contour3d,
|
||||||
|
:heatmap,
|
||||||
|
:pie,
|
||||||
|
:image,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
function pgfx_marker(plotattributes, i = 1)
|
function pgfx_marker(plotattributes, i = 1)
|
||||||
shape = _cycle(plotattributes[:markershape], i)
|
shape = _cycle(plotattributes[:markershape], i)
|
||||||
cstr = plot_color(
|
cstr = plot_color(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user