plotjuliagadfly

Horizontal line in Gadfly


I am using Gadfly.jl in order to plot my function. I try to add a horizontal line by passing the Geom.hline argument. However, I am getting an error:

Couldn't process recipe args: (typeof(f), Int64, Float64, Gadfly.Geom.HLineGeometry)

What am I missing?

Here is my code

using Gadfly

f(x)=x/(1-x)

plot(f,0,0.8, yintercept=1.5,  Geom.hline(style=:dot))

Solution

  • It seems that yintercept aesthetics accepts only an array of values:

    plot(f,0,0.8, yintercept=[1.5], Geom.hline(style=:dot))