From c56654c6cfe752838f4c4c56e81b06f0144f7106 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 1 Apr 2021 17:21:29 +0200 Subject: [PATCH] fix multiple legend in pgfplotsx bar plots --- src/backends/pgfplotsx.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index ebe445a8..8967c855 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -341,7 +341,7 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o # treat segments segments = collect(series_segments(series, series[:seriestype])) sf = opt[:fillrange] - for segment in segments + for (k, segment) in enumerate(segments) i, rng = segment.attr_index, segment.range segment_opt = PGFPlotsX.Options() segment_opt = merge(segment_opt, pgfx_linestyle(opt, i)) @@ -397,7 +397,7 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o ) end end - if i == 1 && + if k == 1 && series[:subplot][:legend] != :none && pgfx_should_add_to_legend(series) pgfx_filllegend!(series_opt, opt) end