JuliaStats / KernelDensity.jl

Kernel density estimators for Julia
Other
177 stars 40 forks source link

Using UnicodePlots.jl for Base.show? #19

Open joshday opened 9 years ago

joshday commented 9 years ago

For AverageShiftedHistograms.jl, I'm using the new UnicodePlots.jl for Base.show methods. This gives a simple look at the density and makes for quick comparisons between smoothing parameter/kernel options. I think this would be a cool addition to KernelDensity. Any thoughts?

Here's an example (it looks good in the REPL...border is off with copy/paste)

julia> o = ash(randn(1000), nbins = 75)
AverageShiftedHistograms.UnivariateASH
*  kernel: biweight
*       m: 5
*   edges: -4.775108686536068:0.12562952377203349:4.647105596366442
*    nobs: 1000
        ┌────────────────────────────────────────┐ 
    0.5 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠉⠀⠀⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⠀⠀⠀⠀⠀⠹⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀⠀⠀⠀⠀⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠜⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        │⠒⠒⠒⠒⠒⠒⠒⠒⠛⠛⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠛⠛⠓⠒⠒⠒⠒⠒⠒⠂│ 
   -0.1 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
        └────────────────────────────────────────┘ 
        -5                                       5
johnmyleswhite commented 9 years ago

I used to be strongly in favor of these sorts of things, but I think they're going to make a mess of our codebase until there's a single plotting library that everyone uses for everything.

joshday commented 9 years ago

I don't think it would be too messy since it's only for Base.show methods. This is helpful when using the REPL, not needing to go back and forth between plotting and trying out parameters.

Evizero commented 8 years ago

I know this issue is quite old, but since it is still open (and I just now discovered it), allow me to leave my 2 cents.

My philosophy with UnicodePlots is to provide a very lightweight way to create quick and dirty plots. Right now (for 0.4) there are zero dependencies on external packages. I have no illusion of making the package comparable with PyPlot or Gadfly, simply because I don't think that would be useful. In my mind UnicodePlots has a very different goal than other plotting packages.

The two main use-cases I prioritize above all others:

  1. Quick visualisations when working interactively in the REPL
  2. Increase information density or improve information quality for custom print and show methods (which includes use-cases such as logging)

Mhm.. maybe I should write something like that into the readme

simonbyrne commented 8 years ago

I don't think I want to add a dependency, but we certainly could improve the show output.