Plot different length data together in Gadfly

The top plot can be done like this too:

layer1 = layer(x=x1, y=y1, Geom.line, color=["Theory"])
layer2 = layer(x=x2, y=y2, Geom.line, color=["Data"])
p = plot(layer1, layer2, style(line_width=2pt),
     Guide.xlabel("x"), Guide.ylabel("y"), Guide.colorkey(""))

plot01

2 Likes