1

So, I've been playing around with Gadfly in Julia and run into this issue.

Geom.ribbon does't accept Int vectors as input for ymin and ymax when used in combination with Geom.smooth.

I was wondering if this is a bug, is intended, or if I'm doing anything wrong and why?

In [1]: 
x=[-10:10]
y=[i^2 for i in -10:10]
ymin = y-10
ymax = y+10;

In [2]: 
plot(x=x, y=y, ymin=ymin, ymax=ymax, Geom.smooth, Geom.ribbon)

Out[2]: 
`minvalmaxval` has no method matching minvalmaxval(::Int64, ::Float64, ::Int64, ::Nothing, ::Nothing)

 in apply_statistic_typed at C:\Users\epintos\.julia\v0.3\Gadfly\src\statistics.jl:709
 in apply_statistic at C:\Users\epintos\.julia\v0.3\Gadfly\src\statistics.jl:551
 in apply_statistics at C:\Users\epintos\.julia\v0.3\Gadfly\src\statistics.jl:37
 in render at C:\Users\epintos\.julia\v0.3\Gadfly\src\Gadfly.jl:717
 in writemime at C:\Users\epintos\.julia\v0.3\Gadfly\src\Gadfly.jl:884
 in sprint at iostream.jl:229
 in display_dict at C:\Users\epintos\.julia\v0.3\IJulia\src\execute_request.jl:31

In [3]:
ymin = float64(ymin)
ymax = float64(ymax);

In [4]:    
plot(x=x, y=y, ymin=ymin, ymax=ymax, Geom.smooth, Geom.ribbon)

What's weird is that

plot(x=x, y=y, ymin=ymin, ymax=ymax, Geom.line, Geom.ribbon)

works even if all vectors are Int

epx
  • 799
  • 4
  • 12

1 Answers1

1

Its a bug in Gadfly, you can see the line here

function minvalmaxval{T}(minval::T, maxval::T, val, s, ds)

Which requires that minval and maxval have the same type. Relatively easy to fix, you should file an issue. Until it is, your fix is a sensible one.

IainDunning
  • 11,546
  • 28
  • 43