GiovineItalia / Gadfly.jl

Crafty statistical graphics for Julia.
http://gadflyjl.org/stable/
Other
1.9k stars 251 forks source link

InexactError #860

Closed ShnitzelKiller closed 5 years ago

ShnitzelKiller commented 8 years ago

When plotting a collection with exactly one data point using Geom.histogram2d or Geom.hexbin, Gadfly crashes: julia> plot(x=[0], y=[0], Geom.histogram2d)

ERROR: InexactError()
 in trunc at /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
 in choose_bin_count_2d at /Users/james/.julia/v0.4/Gadfly/src/bincount.jl:256
 in apply_statistic at /Users/james/.julia/v0.4/Gadfly/src/statistics.jl:607
 in apply_statistics at /Users/james/.julia/v0.4/Gadfly/src/statistics.jl:38
 in render_prepare at /Users/james/.julia/v0.4/Gadfly/src/Gadfly.jl:671
 in render at /Users/james/.julia/v0.4/Gadfly/src/Gadfly.jl:718
 in display at /Users/james/.julia/v0.4/Gadfly/src/Gadfly.jl:952
 [inlined code] from multimedia.jl:151
 in display at /Users/james/.julia/v0.4/Gadfly/src/Gadfly.jl:904
 in print_response at REPL.jl:134
 in print_response at REPL.jl:121
 in anonymous at REPL.jl:624
 in run_interface at /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
 in run_frontend at /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
 in run_repl at /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
 in _start at /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib

This also happens when specifying your own bin counts.

tlnagy commented 8 years ago

I can reproduce this, but I'm not sure what the proper way to handle this is. How would you even set up binning when there is only one datapoint?

tlnagy commented 8 years ago

@shashi any idea how to handle this?