# Unexpected and unclear labels' grouping in the legend when using plotly(js) backend with subplots

**URL:** <https://discourse.julialang.org/t/unexpected-and-unclear-labels-grouping-in-the-legend-when-using-plotly-js-backend-with-subplots/65632>\
**Category:** Visualization\
**Tags:** plotting, plots\
**Created:** [August 1, 2021, 2:24pm UTC](https://discourse.julialang.org/t/unexpected-and-unclear-labels-grouping-in-the-legend-when-using-plotly-js-backend-with-subplots/65632 "2021-08-01T14:24:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianmariomanca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gianmariomanca/32/25597_2.png) [@gianmariomanca](https://discourse.julialang.org/u/gianmariomanca)\
**Post date:** [August 1, 2021, 2:24pm UTC](https://discourse.julialang.org/t/unexpected-and-unclear-labels-grouping-in-the-legend-when-using-plotly-js-backend-with-subplots/65632/1 "2021-08-01T14:24:35Z")

</div>

```julia
begin
	using StatsPlots

	gr()
	# pgfplotsx()
	# plotlyjs()
	# plotly()
	
	serie1=rand(5)
	serie2=rand(5)
	serie3=rand(10)
	serie4=rand(10)
	
	pg = plot(
	   plot([serie3 serie4], label=["Serie1" "Serie2"]),
	   plot([serie3 serie4], label=["Serie3" "Serie4"]),
	   layout=(1,2), size=(600,300), grid=:off,
	   left_margin = 5Plots.mm
	)
	#savefig(pg,"test.pdf")
end

```

gives

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/5/756db4dc07337c2e3fde017aa6a2a27d27ad1fd7.png)  
so far so good.  
Also pgfplotsx() is fine but if I want to use **plotly()** (or plotlyjs()) I get  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/8/88ef279deb5dc223d24265d5228ed4716070ff05.png)  
with all the labels grouped together which makes it ambiguous.

Why the different behavior?  
Any suggestions to “fix” the plotly case?

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [August 1, 2021, 11:27pm UTC](https://discourse.julialang.org/t/unexpected-and-unclear-labels-grouping-in-the-legend-when-using-plotly-js-backend-with-subplots/65632/2 "2021-08-01T23:27:01Z")

</div>

The plotly() backend might be hopeless for this task - see [this Plots.jl issue](https://github.com/JuliaPlots/Plots.jl/issues/673#issuecomment-668957032).

---

<div class="post-metadata">

**Author:** ![gianmariomanca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gianmariomanca/32/25597_2.png) [@gianmariomanca](https://discourse.julialang.org/u/gianmariomanca)\
**Post date:** [August 2, 2021, 2:35am UTC](https://discourse.julialang.org/t/unexpected-and-unclear-labels-grouping-in-the-legend-when-using-plotly-js-backend-with-subplots/65632/3 "2021-08-02T02:35:03Z")

</div>

Thank you for the link.
