Hello,
I am assigning the color of a plot drawn with PyPlot manually, I need to assign the same color to the legend. How can I control the color parameter?
I am using the following but it gives me an error:
legend(["A", "B", "C"],
color = ["blue", "red", "green"],
loc="best")
if you’re looking to color the text in the legend, one way to do it by looping over the text objects after creating the legend.
l = legend(["A", "B", "C"], loc="best")
for t in l.get_texts()
if t.get_text() == "A"
setp(t, color="blue")
elseif t.get_text() == "B"
setp(t, color="red")
elseif t.get_text() == "C"
setp(t, color="green")
end
end
Thank you, but the color of text I found I could change it directly with labelcolor = ["blue", "red", "green"].
I am looking for the same construct but for the color of the lines (and, prospectively, the icons)…