For a histogram of given random variable X, I I graph the kernal density estimation along with the correct histogram of the given sample, where the histogram has the transparency of 0.5.
I want my legend to reflect my color choice. But instead, it shows me the color of my KDE.
How do you match the 0.5 transparency, and the given color, to the legend?
In your scatter trace you should set line_color, not marker_color, because you have mode="lines"!!!
I suspect that you are perceiving a difference in color, because you have a black background for the plot, and a white one for the legend.
This is an example that also has a black legend background:
In my case as well, it’s an artefact of dark mode in which case somehow the colors do not appear to be fully in sync between the two areas (the legend and the plot) but rather they are slightly offset compared to one another ― The colors in the legend appear a bit brighter than in the plot itself.
This is in Chrome in my case, with a px.line and a px.scatter (but not with a go.Scatter).
It’s definitely not an illusion however, they are not the same color, at least in my case.