# Legends of colors with ListPlot

I'm taking this example in the documentation :

ListPlot[Table[
Style[{Cos[t], Sin[2 t]}, Hue[t/(2 Pi)]], {t, 0, 2 Pi, Pi/20}],
PlotStyle -> PointSize[Medium]]


I'd like to write a colored PlotLegend (like in a DensityPlot) for this plot of this style :

and associate it with a value that would be for example :

Table[t/(2 Pi), {t, 0, 2 Pi, Pi/20}]


Remark: Actually, it would be sufficient for me to plot a density plot with those values and the plot legends with the same hues as in the ListPlot, and I would copy-past this colored legend. But I also don't know how to do that.

• ListPlot[Table[Style[{Cos[t], Sin[2 t]}, Hue[t/(2 Pi)]], {t, 0, 2 Pi, Pi/20}], PlotLegends -> BarLegend[{Hue, {0, 1}}]] ? – ktm Apr 2 '20 at 15:54

legend1 = BarLegend[{Hue, {0, 2 Pi}}];

ListPlot[Table[Style[{Cos[t], Sin[2 t]}, Hue[t/(2 Pi)]], {t, 0, 2 Pi, Pi/20}],
PlotLegends -> legend1]


Also

Legended[ListPlot[Table[Style[{Cos[t], Sin[2 t]}, Hue[t/(2 Pi)]], {t, 0, 2 Pi, Pi/20}]],
Placed[legend1, Right]]


same picture