I have two layers that I would like to plot as Geom.point
. From the Gadfly documentation, I believe this should be possible, though the example only covers the case where the layer Geom types are different. However, when I attempt this (Julia 0.3.0-prerelease+2584, Gadfly v0.2.8) it throws an error:
x = [83, 71, 79, 71, 73, 66, 78, 70, 69, 84, 59, 66, 73]
y = [59, 47, 33, 68, 56, 61, 51, 45, 50, 44, 60, 62, 50]
ox = 74
oy = 49
plot(layer(x=x, y=y, Geom.point),
layer(x=ox, y=oy, Geom.point))
# BoundsError()
# in eval_plot_mapping at /Users/peter/.julia/v0.3/Gadfly/src/Gadfly.jl:317
# in render at /Users/peter/.julia/v0.3/Gadfly/src/Gadfly.jl:448
# in writemime at /Users/peter/.julia/v0.3/Gadfly/src/Gadfly.jl:753
# in sprint at io.jl:460
# in display_dict at /Users/peter/.julia/v0.3/IJulia/src/execute_request.jl:35
Ultimately, I'd also like to manually specify an aesthetic for the layer (e.g. Geom.point(color="red")
.
Am I missing something about the slang of graphics, or are two same type Geom layers not supported in the slang? If they are, then how can I go about setting different aesthetics for each layer?
Gadfly expects x and y to be vectors, so plotting scalars won't work.
Besides providing a separate string for each layer to get different colors you can also use
Theme
to change the color manually, for example:Theme(default_color=color("red"))