diff --git a/src/PGFPlots.jl b/src/PGFPlots.jl index f94da2a..24e84ba 100644 --- a/src/PGFPlots.jl +++ b/src/PGFPlots.jl @@ -703,8 +703,7 @@ function plotHelper(o::IO, axis::Axis) legendentries = vcat(legendentries...) # flatten # avoid adding \legend altogether if all entries are `nothing` if !all(legendentries .=== nothing) - legendentries = replace(legendentries, nothing=>"") # for correct printing - legendcontent = join(legendentries, ',') + legendcontent = join(map(x->x === nothing ? "" : "{}{$x}", legendentries), ", ") println(o, "\\legend{$legendcontent}") # add legend end end