0

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"))
Frash
  • 724
  • 1
  • 10
  • 19

1 Answers1

2

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.

limes
  • 608
  • 5
  • 9