From fd17dceeccce0be29914a857267cdf483471fda7 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Wed, 11 Mar 2020 12:11:10 +0100 Subject: [PATCH] handle unmatching vectors --- src/backends/pgfplotsx.jl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index 1d8ad070..d2dd3c29 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -348,17 +348,20 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) # add to legend? if sp[:legend] != :none && pgfx_should_add_to_legend(series) leg_entry = if opt[:label] isa AVec - opt[:label][i] + get(opt[:label], i, "") elseif opt[:label] isa AbstractString - if i == 1 && opt[:label] != "" + if i == 1 opt[:label] else - push!(segment_plot.options, "forget plot" => nothing) - continue + "" end else throw(ArgumentError("Malformed label. label = $(opt[:label])")) end + if leg_entry == "" + push!(segment_plot.options, "forget plot" => nothing) + continue + end leg_opt = PGFPlotsX.Options() if ribbon !== nothing pgfx_filllegend!(axis.contents[end - 3].options, opt)