From e3e86aa6cd42c6efa79125e8ae85f6dd6f4a2cd3 Mon Sep 17 00:00:00 2001 From: Stephan Antholzer Date: Fri, 22 Apr 2022 11:12:55 +0200 Subject: [PATCH] merge series extra_kwargs for plotly_series (#4172) --- src/backends/plotly.jl | 6 ++++-- test/test_plotly.jl | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 205e7dc1..34474302 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -753,7 +753,8 @@ function plotly_series(plt::Plot, series::Series) plotly_polar!(plotattributes_out, series) plotly_adjust_hover_label!(plotattributes_out, series[:hover]) - return [plotattributes_out] + + return [merge(plotattributes_out, series[:extra_kwargs])] end function plotly_series_shapes(plt::Plot, series::Series, clims) @@ -807,7 +808,7 @@ function plotly_series_shapes(plt::Plot, series::Series, clims) plotattributes_out[:showlegend] = k == 1 ? should_add_to_legend(series) : false plotly_polar!(plotattributes_out, series) plotly_adjust_hover_label!(plotattributes_out, _cycle(series[:hover], i)) - plotattributes_outs[k] = plotattributes_out + plotattributes_outs[k] = merge(plotattributes_out, series[:extra_kwargs]) end if series[:fill_z] !== nothing push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :fill)) @@ -968,6 +969,7 @@ function plotly_series_segments(series::Series, plotattributes_base::KW, x, y, z else plotattributes_outs[k] = plotattributes_out end + plotattributes_outs[k] = merge(plotattributes_outs[k], series[:extra_kwargs]) end if series[:line_z] !== nothing diff --git a/test/test_plotly.jl b/test/test_plotly.jl index e6cd20a9..bd127030 100644 --- a/test/test_plotly.jl +++ b/test/test_plotly.jl @@ -55,4 +55,10 @@ using Plots, Test end end end + @testset "Extra kwargs" begin + pl = plot(1:5, test = "me") + @test Plots.plotly_series(pl)[1][:test] == "me" + pl = plot(1:5, test = "me", extra_kwargs = :plot) + @test Plots.plotly_layout(pl)[:test] == "me" + end end