From e8734daa4d4457d93ca6d5073dc98cf52676dcf7 Mon Sep 17 00:00:00 2001 From: Christoph Finkensiep Date: Sat, 5 May 2018 12:27:16 +0200 Subject: [PATCH] add legendgroups to shapes/segments and remove gaps in legend --- src/backends/plotly.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index f1daf3d7..0e6addbe 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -388,6 +388,7 @@ function plotly_layout(plt::Plot) :bgcolor => rgba_string(sp[:background_color_legend]), :bordercolor => rgba_string(sp[:foreground_color_legend]), :font => plotly_font(legendfont(sp)), + :tracegroupgap => 0, :x => xpos, :y => ypos ) @@ -678,7 +679,7 @@ function plotly_series_shapes(plt::Plot, series::Series) base_d[:xaxis] = "x$(x_idx)" base_d[:yaxis] = "y$(y_idx)" base_d[:name] = series[:label] - # base_d[:legendgroup] = series[:label] + base_d[:legendgroup] = series[:label] x, y = (plotly_data(series, letter, data) for (letter, data) in zip((:x, :y), shape_data(series)) @@ -733,6 +734,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z) d_out = deepcopy(d_base) d_out[:showlegend] = i==1 ? should_add_to_legend(series) : false + d_out[:legendgroup] = series[:label] # set the type if st in (:path, :scatter, :scattergl, :straightline)