7

Plotting functions directly is easy in Gadfly:

plot([sin, cos], 0, 25)

This gives my two differently colored lines, automatically labelled in the legend as something like f_1 and f_2:

enter image description here

How can I change the default names in the "Color" legend?

phipsgabler
  • 20,535
  • 4
  • 40
  • 60

1 Answers1

5

Set the color argument to a list of labels:

plot([sin, cos], 0, 25, color=["sine", "cosine"])

Update labels

evan.oman
  • 5,922
  • 22
  • 43
  • Ah, and the reason is that it gets converted to a [Geom.line with Stat.func](https://github.com/GiovineItalia/Gadfly.jl/blob/d36d54ea7b9648851d0f0a4d3577b0f813af7e2f/src/poetry.jl#L41). Thanks! – phipsgabler May 06 '17 at 09:50