fixed numeric array without numeric type; updated readme; closes #64

This commit is contained in:
Thomas Breloff 2015-11-10 16:38:47 -05:00
parent a40d0000c5
commit e596f27666
15 changed files with 78 additions and 33 deletions

View File

@ -52,7 +52,8 @@ Pkg.add("Gadfly")
Pkg.add("Immerse") Pkg.add("Immerse")
Pkg.add("PyPlot") Pkg.add("PyPlot")
Pkg.add("UnicodePlots") Pkg.add("UnicodePlots")
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git") Pkg.add("Qwt")
Pkg.add("Bokeh")
``` ```
## Use ## Use
@ -206,14 +207,13 @@ Keyword | Default | Type | Aliases
---- | ---- | ---- | ---- ---- | ---- | ---- | ----
`:annotation` | `nothing` | Series | `:ann`, `:annotate`, `:annotations`, `:anns` `:annotation` | `nothing` | Series | `:ann`, `:annotate`, `:annotations`, `:anns`
`:axis` | `left` | Series | `:axiss` `:axis` | `left` | Series | `:axiss`
`:background_color` | `RGB{U8}(1.0,1.0,1.0)` | Plot | `:background`, `:bg`, `:bg_color`, `:bgcolor` `:background_color` | `RGB{U8}(1.0,1.0,1.0)` | Plot | `:background`, `:background_colour`, `:bg`, `:bg_color`, `:bgcolor`
`:color` | `auto` | Series | `:c`, `:colors`
`:color_palette` | `auto` | Plot | `:palette` `:color_palette` | `auto` | Plot | `:palette`
`:fill` | `nothing` | Series | `:area`, `:f` `:fill` | `nothing` | Series | `:area`, `:f`
`:fillcolor` | `match` | Series | `:fc`, `:fcolor`, `:fillcolors` `:fillalpha` | `nothing` | Series | `:fa`, `:fillalphas`, `:fillopacity`
`:fillalpha` | `nothing` | Series | `:fillalphas`, `:fo` `:fillcolor` | `match` | Series | `:fc`, `:fcolor`, `:fillcolors`, `:fillcolour`
`:fillrange` | `nothing` | Series | `:fillranges`, `:fillrng` `:fillrange` | `nothing` | Series | `:fillranges`, `:fillrng`
`:foreground_color` | `auto` | Plot | `:fg`, `:fg_color`, `:fgcolor`, `:foreground` `:foreground_color` | `auto` | Plot | `:fg`, `:fg_color`, `:fgcolor`, `:foreground`, `:foreground_colour`
`:grid` | `true` | Plot | `:grid` | `true` | Plot |
`:group` | `nothing` | Series | `:g`, `:groups` `:group` | `nothing` | Series | `:g`, `:groups`
`:guidefont` | `Plots.Font("Helvetica",11,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot | `:guidefont` | `Plots.Font("Helvetica",11,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot |
@ -222,7 +222,8 @@ Keyword | Default | Type | Aliases
`:legend` | `true` | Plot | `:leg` `:legend` | `true` | Plot | `:leg`
`:legendfont` | `Plots.Font("Helvetica",8,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot | `:legendfont` | `Plots.Font("Helvetica",8,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot |
`:line` | `nothing` | Series | `:l` `:line` | `nothing` | Series | `:l`
`:linealpha` | `nothing` | Series | `:linealphas`, `:lo` `:linealpha` | `nothing` | Series | `:la`, `:linealphas`, `:lineopacity`
`:linecolor` | `auto` | Series | `:c`, `:color`, `:colour`, `:linecolors`
`:linestyle` | `solid` | Series | `:linestyles`, `:ls`, `:s`, `:style` `:linestyle` | `solid` | Series | `:linestyles`, `:ls`, `:s`, `:style`
`:linetype` | `path` | Series | `:linetypes`, `:lt`, `:t`, `:type` `:linetype` | `path` | Series | `:linetypes`, `:lt`, `:t`, `:type`
`:linewidth` | `1` | Series | `:linewidths`, `:lw`, `:w`, `:width` `:linewidth` | `1` | Series | `:linewidths`, `:lw`, `:w`, `:width`
@ -231,18 +232,24 @@ Keyword | Default | Type | Aliases
`:linkx` | `false` | Plot | `:xlink` `:linkx` | `false` | Plot | `:xlink`
`:linky` | `false` | Plot | `:ylink` `:linky` | `false` | Plot | `:ylink`
`:marker` | `nothing` | Series | `:m`, `:mark` `:marker` | `nothing` | Series | `:m`, `:mark`
`:markercolor` | `match` | Series | `:markercolors`, `:mc`, `:mcolor` `:markeralpha` | `nothing` | Series | `:alpha`, `:ma`, `:markeralphas`, `:markeropacity`, `:opacity`
`:markeralpha` | `nothing` | Series | `:alpha`, `:markeralphas`, `:mo`, `:alpha` `:markercolor` | `match` | Series | `:markercolors`, `:markercolour`, `:mc`, `:mcolor`
`:markershape` | `none` | Series | `:markershapes`, `:shape` `:markershape` | `none` | Series | `:markershapes`, `:shape`
`:markersize` | `6` | Series | `:markersizes`, `:ms`, `:msize` `:markersize` | `6` | Series | `:markersizes`, `:ms`, `:msize`
`:markerstrokealpha` | `nothing` | Series | `:markerstrokealphas`
`:markerstrokecolor` | `match` | Series | `:markerstrokecolors`
`:markerstrokestyle` | `solid` | Series | `:markerstrokestyles`
`:markerstrokewidth` | `1` | Series | `:markerstrokewidths`
`:n` | `-1` | Plot | `:n` | `-1` | Plot |
`:nbins` | `100` | Series | `:nb`, `:nbin`, `:nbinss` `:nbins` | `30` | Series | `:nb`, `:nbin`, `:nbinss`
`:nc` | `-1` | Plot | `:nc` | `-1` | Plot |
`:nlevels` | `15` | Series | `:nlevelss`
`:nr` | `-1` | Plot | `:nr` | `-1` | Plot |
`:pos` | `(0,0)` | Plot | `:pos` | `(0,0)` | Plot |
`:show` | `false` | Plot | `:display`, `:gui` `:show` | `false` | Plot | `:display`, `:gui`
`:size` | `(500,300)` | Plot | `:windowsize`, `:wsize` `:size` | `(500,300)` | Plot | `:windowsize`, `:wsize`
`:smooth` | `false` | Series | `:reg`, `:regression`, `:smooths` `:smooth` | `false` | Series | `:reg`, `:regression`, `:smooths`
`:surface` | `nothing` | Series | `:surfaces`
`:tickfont` | `Plots.Font("Helvetica",8,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot | `:tickfont` | `Plots.Font("Helvetica",8,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot |
`:title` | `` | Plot | `:title` | `` | Plot |
`:windowtitle` | `Plots.jl` | Plot | `:wtitle` `:windowtitle` | `Plots.jl` | Plot | `:wtitle`
@ -280,6 +287,9 @@ Type | Desc | Aliases
`:hline` | Horizontal line (doesn't use x) | `:hline` | Horizontal line (doesn't use x) |
`:vline` | Vertical line (doesn't use x) | `:vline` | Vertical line (doesn't use x) |
`:ohlc` | Open/High/Low/Close chart (expects y is AbstractVector{Plots.OHLC}) | `:ohlc` | Open/High/Low/Close chart (expects y is AbstractVector{Plots.OHLC}) |
`:contour` | Contour lines (uses z) |
`:path3d` | 3D path (uses z) | `:line3d`
`:scatter3d` | 3D scatter plot (uses z) |
### Line styles: ### Line styles:

View File

@ -315,6 +315,9 @@ end
:hline => "Horizontal line (doesn't use x)", :hline => "Horizontal line (doesn't use x)",
:vline => "Vertical line (doesn't use x)", :vline => "Vertical line (doesn't use x)",
:ohlc => "Open/High/Low/Close chart (expects y is AbstractVector{Plots.OHLC})", :ohlc => "Open/High/Low/Close chart (expects y is AbstractVector{Plots.OHLC})",
:contour => "Contour lines (uses z)",
:path3d => "3D path (uses z)",
:scatter3d => "3D scatter plot (uses z)",
) )
function buildReadme() function buildReadme()

View File

@ -52,7 +52,8 @@ Pkg.add("Gadfly")
Pkg.add("Immerse") Pkg.add("Immerse")
Pkg.add("PyPlot") Pkg.add("PyPlot")
Pkg.add("UnicodePlots") Pkg.add("UnicodePlots")
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git") Pkg.add("Qwt")
Pkg.add("Bokeh")
``` ```
## Use ## Use

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -137,7 +137,7 @@ end
# ---------------------------------------------------------------- # ----------------------------------------------------------------
function _create_subplot(subplt::Subplot{BokehPackage}) function _create_subplot(subplt::Subplot{BokehPackage}, isbefore::Bool)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example # TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
end end

View File

@ -159,7 +159,7 @@ function addGadflyMarker!(plt::Plot, numlayers::Int, d::Dict, plotargs::Dict, ge
# handle continuous color scales for the markers # handle continuous color scales for the markers
z = d[:z] z = d[:z]
if z != nothing && typeof(z) <: AVec if z != nothing && typeof(z) <: AVec
kwargs[:linecolor] = z kwargs[:color] = z
if !isa(d[:markercolor], ColorGradient) if !isa(d[:markercolor], ColorGradient)
d[:markercolor] = colorscheme(:bluesreds) d[:markercolor] = colorscheme(:bluesreds)
end end

View File

@ -148,7 +148,6 @@ end
handleSmooth(plt::Plot{PyPlotPackage}, ax, d::Dict, smooth::Real) = handleSmooth(plt, ax, d, true) handleSmooth(plt::Plot{PyPlotPackage}, ax, d::Dict, smooth::Real) = handleSmooth(plt, ax, d, true)
nop() = nothing
makePyPlotCurrent(wrap::PyPlotFigWrapper) = PyPlot.figure(wrap.fig.o[:number]) makePyPlotCurrent(wrap::PyPlotFigWrapper) = PyPlot.figure(wrap.fig.o[:number])

View File

@ -225,7 +225,15 @@ convertToAnyVector(f::Function; kw...) = Any[f], nothing
convertToAnyVector(v::AVec{OHLC}; kw...) = Any[v], nothing convertToAnyVector(v::AVec{OHLC}; kw...) = Any[v], nothing
# list of things (maybe other vectors, functions, or something else) # list of things (maybe other vectors, functions, or something else)
convertToAnyVector(v::AVec; kw...) = Any[vi for vi in v], nothing function convertToAnyVector(v::AVec; kw...)
if all(x -> typeof(x) <: Real, v)
# all real numbers wrap the whole vector as one item
Any[convert(Vector{Float64}, v)], nothing
else
# something else... treat each element as an item
Any[vi for vi in v], nothing
end
end
# -------------------------------------------------------------------- # --------------------------------------------------------------------
@ -254,8 +262,6 @@ function createKWargsList(plt::PlottingObject, x, y; kw...)
xs, xmeta = convertToAnyVector(x; kw...) xs, xmeta = convertToAnyVector(x; kw...)
ys, ymeta = convertToAnyVector(y; kw...) ys, ymeta = convertToAnyVector(y; kw...)
# _debugMode.on && dumpcallstack()
mx = length(xs) mx = length(xs)
my = length(ys) my = length(ys)
ret = Any[] ret = Any[]

View File

@ -116,6 +116,9 @@ end
# ------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------
nop() = nothing
get_mod(v::AVec, idx::Int) = v[mod1(idx, length(v))] get_mod(v::AVec, idx::Int) = v[mod1(idx, length(v))]
get_mod(v::AMat, idx::Int) = size(v,1) == 1 ? v[1, mod1(idx, size(v,2))] : v[:, mod1(idx, size(v,2))] get_mod(v::AMat, idx::Int) = size(v,1) == 1 ? v[1, mod1(idx, size(v,2))] : v[:, mod1(idx, size(v,2))]
get_mod(v, idx::Int) = v get_mod(v, idx::Int) = v

View File

@ -54,13 +54,21 @@ end
"Show a Gtk popup with both images and a confirmation whether we should replace the new image with the old one" "Show a Gtk popup with both images and a confirmation whether we should replace the new image with the old one"
function compareToReferenceImage(tmpfn, reffn) function compareToReferenceImage(tmpfn, reffn)
@eval import Gtk println("here000")
# @eval import Gtk
Gtk.gtk_main()
println("huh0")
sleep(2)
# add the images # add the images
imgbox = Gtk.GtkBoxLeaf(:h) imgbox = Gtk.GtkBoxLeaf(:h)
println("huh")
push!(imgbox, makeImageWidget(tmpfn)) push!(imgbox, makeImageWidget(tmpfn))
println("huh2")
push!(imgbox, makeImageWidget(reffn)) push!(imgbox, makeImageWidget(reffn))
println("here00")
# add the buttons # add the buttons
# doNothingButton = Gtk.GtkButtonLeaf("Skip") # doNothingButton = Gtk.GtkButtonLeaf("Skip")
# replaceReferenceButton = Gtk.GtkButtonLeaf("Replace reference image") # replaceReferenceButton = Gtk.GtkButtonLeaf("Replace reference image")
@ -75,14 +83,28 @@ function compareToReferenceImage(tmpfn, reffn)
win = Gtk.GtkWindowLeaf("Should we make this the new reference image?") win = Gtk.GtkWindowLeaf("Should we make this the new reference image?")
push!(win, Gtk.GtkFrameLeaf(imgbox)) push!(win, Gtk.GtkFrameLeaf(imgbox))
println("here01")
################
# TODO: remove this when it's fixed in Gtk... see http://stackoverflow.com/questions/33549485/julia-gtk-windows-do-not-display-outside-repl
signal_connect(win, :destroy) do widget
Gtk.gtk_quit()
end
################
println("here02")
showall(win) showall(win)
println("here1")
# now ask the question # now ask the question
if Gtk.ask_dialog("Should we make this the new reference image?", "No", "Yes") if Gtk.ask_dialog("Should we make this the new reference image?", "No", "Yes")
replaceReferenceImage(tmpfn, reffn) replaceReferenceImage(tmpfn, reffn)
end end
println("here2")
destroy(win) destroy(win)
println("here3")
# # we'll wait on this condition # # we'll wait on this condition
# c = Condition() # c = Condition()
@ -156,13 +178,14 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, sigma = [1
catch err catch err
warn("Image did not match reference image $reffn. err: $err") warn("Image did not match reference image $reffn. err: $err")
showerror(Base.STDERR, err) # showerror(Base.STDERR, err)
if isinteractive() if isinteractive()
# if we're in interactive mode, open a popup and give us a chance to examine the images # if we're in interactive mode, open a popup and give us a chance to examine the images
warn("Should we make this the new reference image?") warn("Should we make this the new reference image?")
compareToReferenceImage(tmpfn, reffn) compareToReferenceImage(tmpfn, reffn)
println("exited")
return return
else else