JuliaPlots / PlotlyJS.jl

Julia library for plotting with plotly.js
Other
418 stars 77 forks source link

Too many entries in subplots legends #407

Closed empet closed 3 years ago

empet commented 3 years ago

I experimented make_subplots(), and I noticed that for two subplots with a trace each one I get a legend with 4 traces:

using PlotlyJS
include("plotlyju.jl")
pl = make_subplots(rows=1, cols=2, horizontal_spacing=0.04, 
                   subplot_titles=permutedims(["Title 1", "Title 2"]))
pl.plot.style=plotlyju
add_trace!(pl, scatter(x=1:5, y=rand(2:7, 5)), row=1, col=1)
add_trace!(pl, scatter(x=-2:3, y=rand(1:9, 6)), row=1, col=2)

relayout!(pl, title_text="Subplots", width=600, height=300)

Subplots-with-titles If I remove plotlyju style, the legend is also displaying four traces, but with distinct colors: Subplots-no-style

sglyon commented 3 years ago

whoa this is definitely not supposed to happen. I'll take a look!

sglyon commented 3 years ago

fixed !