Frash
Frash

Reputation: 728

Julia Gadfly error: add_plot_element not found

Using Julia 0.3.10 with Juno as IDE and Gadfly latest one. Tried running a sample code, but got stuck with add_plot_element not defined error message. The last line throws the error. Running on Win8 64bit. I'm sure I'm missing something.

using Gadfly

xs = [0:0.1:pi]
k = layer(x=xs, y=sin(xs))
p = plot(x=xs, y=sin(xs))
add_plot_element(k, Guide.title("Now it has a title"))

Upvotes: 0

Views: 103

Answers (1)

limes
limes

Reputation: 638

First, add_plot_element is modifying, so you need the ! like:

add_plot_element!(k,Guide.title(...))

This function is also not exported from Gadfly, so you would really need to write:

Gadfly.add_plot_element!(k, Guide.title("Now it has a title"))

except add_plot_element! doesn't work on Gadfly layers! It does, however, work on plots. What should work:

Gadfly.add_plot_element!(p, Guide.title("Now it has a title"))

since the layer itself doesn't have Guide.Title elements, but the plot does.

Upvotes: 2

Related Questions