Is there currently a way to add plot elements together in Gadfly.jl?
For example, in R if I have another function that returns a ggplot and I want to add a title to it, I'd do the following:
p <- makeMyPlot()
p + ggtitle("Now it has a title")
Is there currently a Gadfly equivalent? If not, is this on Gadfly's roadmap?
There is add_plot_element()
, which can add stuff to an existing layer:
xs = [0:0.1:pi]
l = layer(x=xs, y=sin(xs))
add_plot_element(l, Guide.title("Now it has a title"))
You can then plot the layer using plot(l)
, and invoke either draw
or display
to actually show something. Further down, there's a bunch of overloads that work on a Plot
directly:
p = plot(x=xs, y=sin(xs))
add_plot_element(p, Guide.title("Now it has a title"))
display(p)
I can't find either of these functions in the documentation, but fortunately the source is comprehensible enough. One of the many joys of Julia =)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With