KernelDensity.jl icon indicating copy to clipboard operation
KernelDensity.jl copied to clipboard

Using UnicodePlots.jl for Base.show?

Open joshday opened this issue 10 years ago • 4 comments
trafficstars

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

joshday avatar Aug 24 '15 17:08 joshday

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.

johnmyleswhite avatar Aug 24 '15 17:08 johnmyleswhite

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.

joshday avatar Aug 25 '15 15:08 joshday

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

Evizero avatar Oct 17 '15 16:10 Evizero

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

simonbyrne avatar Aug 25 '16 12:08 simonbyrne