diff --git a/src/PGFPlots.jl b/src/PGFPlots.jl index 27df0ed..313a63c 100644 --- a/src/PGFPlots.jl +++ b/src/PGFPlots.jl @@ -702,7 +702,7 @@ function plotHelper(o::IO, axis::Axis) end println(o) # empty line between plots end - legendentries = map(p->hasproperty(p, :legendentry) ? p.legendentry : nothing, axis.plots) + legendentries = map(p->:legendentry in propertynames(p) ? p.legendentry : nothing, axis.plots) legendentries = vcat(legendentries...) # flatten # avoid adding \legend altogether if all entries are `nothing` if !all(legendentries .=== nothing)