The only way I’ve figured out to have two layers with different-color lines
and a legend is to do something like this:
plot(
layer(
x = x1,
y = y1,
color = ["Line 1" for i in 1:length(x1)],
Geom.path,
),
layer(
x = x2,
y = y2,
color = ["Line 2" for i in 1:length(x2)],
Geom.path
),
Guide.colorkey("Legend title"),
)
This works in that it gives me a legend with the text I want, but it
doesn’t give me any way to control the color of the lines - I usually do it
with a Theme(default_color=color("red")) or similar, but since I’ve given
each datapoint a color value (which isn’t really a color) that doesn’t have
any effect.
Is there any way I can get a layered plot, where each layer has its own
legend entry, and at the same time control the color of the plot elements
in each layer?
// T