fixed numeric array without numeric type; updated readme; closes #64
30
README.md
@ -52,7 +52,8 @@ Pkg.add("Gadfly")
|
||||
Pkg.add("Immerse")
|
||||
Pkg.add("PyPlot")
|
||||
Pkg.add("UnicodePlots")
|
||||
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git")
|
||||
Pkg.add("Qwt")
|
||||
Pkg.add("Bokeh")
|
||||
```
|
||||
|
||||
## Use
|
||||
@ -206,14 +207,13 @@ Keyword | Default | Type | Aliases
|
||||
---- | ---- | ---- | ----
|
||||
`:annotation` | `nothing` | Series | `:ann`, `:annotate`, `:annotations`, `:anns`
|
||||
`:axis` | `left` | Series | `:axiss`
|
||||
`:background_color` | `RGB{U8}(1.0,1.0,1.0)` | Plot | `:background`, `:bg`, `:bg_color`, `:bgcolor`
|
||||
`:color` | `auto` | Series | `:c`, `:colors`
|
||||
`:background_color` | `RGB{U8}(1.0,1.0,1.0)` | Plot | `:background`, `:background_colour`, `:bg`, `:bg_color`, `:bgcolor`
|
||||
`:color_palette` | `auto` | Plot | `:palette`
|
||||
`:fill` | `nothing` | Series | `:area`, `:f`
|
||||
`:fillcolor` | `match` | Series | `:fc`, `:fcolor`, `:fillcolors`
|
||||
`:fillalpha` | `nothing` | Series | `:fillalphas`, `:fo`
|
||||
`:fillalpha` | `nothing` | Series | `:fa`, `:fillalphas`, `:fillopacity`
|
||||
`:fillcolor` | `match` | Series | `:fc`, `:fcolor`, `:fillcolors`, `:fillcolour`
|
||||
`: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 |
|
||||
`:group` | `nothing` | Series | `:g`, `:groups`
|
||||
`: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`
|
||||
`:legendfont` | `Plots.Font("Helvetica",8,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot |
|
||||
`: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`
|
||||
`:linetype` | `path` | Series | `:linetypes`, `:lt`, `:t`, `:type`
|
||||
`:linewidth` | `1` | Series | `:linewidths`, `:lw`, `:w`, `:width`
|
||||
@ -231,18 +232,24 @@ Keyword | Default | Type | Aliases
|
||||
`:linkx` | `false` | Plot | `:xlink`
|
||||
`:linky` | `false` | Plot | `:ylink`
|
||||
`:marker` | `nothing` | Series | `:m`, `:mark`
|
||||
`:markercolor` | `match` | Series | `:markercolors`, `:mc`, `:mcolor`
|
||||
`:markeralpha` | `nothing` | Series | `:alpha`, `:markeralphas`, `:mo`, `:alpha`
|
||||
`:markeralpha` | `nothing` | Series | `:alpha`, `:ma`, `:markeralphas`, `:markeropacity`, `:opacity`
|
||||
`:markercolor` | `match` | Series | `:markercolors`, `:markercolour`, `:mc`, `:mcolor`
|
||||
`:markershape` | `none` | Series | `:markershapes`, `:shape`
|
||||
`: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 |
|
||||
`:nbins` | `100` | Series | `:nb`, `:nbin`, `:nbinss`
|
||||
`:nbins` | `30` | Series | `:nb`, `:nbin`, `:nbinss`
|
||||
`:nc` | `-1` | Plot |
|
||||
`:nlevels` | `15` | Series | `:nlevelss`
|
||||
`:nr` | `-1` | Plot |
|
||||
`:pos` | `(0,0)` | Plot |
|
||||
`:show` | `false` | Plot | `:display`, `:gui`
|
||||
`:size` | `(500,300)` | Plot | `:windowsize`, `:wsize`
|
||||
`: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 |
|
||||
`:title` | `` | Plot |
|
||||
`:windowtitle` | `Plots.jl` | Plot | `:wtitle`
|
||||
@ -280,6 +287,9 @@ Type | Desc | Aliases
|
||||
`:hline` | Horizontal line (doesn't use x) |
|
||||
`:vline` | Vertical line (doesn't use x) |
|
||||
`: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:
|
||||
|
||||
@ -301,20 +301,23 @@ end
|
||||
|
||||
|
||||
@compat const _ltdesc = Dict(
|
||||
:none => "No line",
|
||||
:line => "Lines with sorted x-axis",
|
||||
:path => "Lines",
|
||||
:steppre => "Step plot (vertical then horizontal)",
|
||||
:steppost => "Step plot (horizontal then vertical)",
|
||||
:sticks => "Vertical lines",
|
||||
:scatter => "Points, no lines",
|
||||
:heatmap => "Colored regions by density",
|
||||
:hexbin => "Similar to heatmap",
|
||||
:hist => "Histogram (doesn't use x)",
|
||||
:bar => "Bar plot (centered on x values)",
|
||||
:hline => "Horizontal line (doesn't use x)",
|
||||
:vline => "Vertical line (doesn't use x)",
|
||||
:ohlc => "Open/High/Low/Close chart (expects y is AbstractVector{Plots.OHLC})",
|
||||
:none => "No line",
|
||||
:line => "Lines with sorted x-axis",
|
||||
:path => "Lines",
|
||||
:steppre => "Step plot (vertical then horizontal)",
|
||||
:steppost => "Step plot (horizontal then vertical)",
|
||||
:sticks => "Vertical lines",
|
||||
:scatter => "Points, no lines",
|
||||
:heatmap => "Colored regions by density",
|
||||
:hexbin => "Similar to heatmap",
|
||||
:hist => "Histogram (doesn't use x)",
|
||||
:bar => "Bar plot (centered on x values)",
|
||||
:hline => "Horizontal line (doesn't use x)",
|
||||
:vline => "Vertical line (doesn't use x)",
|
||||
: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()
|
||||
|
||||
@ -52,7 +52,8 @@ Pkg.add("Gadfly")
|
||||
Pkg.add("Immerse")
|
||||
Pkg.add("PyPlot")
|
||||
Pkg.add("UnicodePlots")
|
||||
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git")
|
||||
Pkg.add("Qwt")
|
||||
Pkg.add("Bokeh")
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 28 KiB |
@ -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
|
||||
|
||||
end
|
||||
|
||||
@ -159,7 +159,7 @@ function addGadflyMarker!(plt::Plot, numlayers::Int, d::Dict, plotargs::Dict, ge
|
||||
# handle continuous color scales for the markers
|
||||
z = d[:z]
|
||||
if z != nothing && typeof(z) <: AVec
|
||||
kwargs[:linecolor] = z
|
||||
kwargs[:color] = z
|
||||
if !isa(d[:markercolor], ColorGradient)
|
||||
d[:markercolor] = colorscheme(:bluesreds)
|
||||
end
|
||||
|
||||
@ -148,7 +148,6 @@ end
|
||||
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])
|
||||
|
||||
12
src/plot.jl
@ -225,7 +225,15 @@ convertToAnyVector(f::Function; kw...) = Any[f], nothing
|
||||
convertToAnyVector(v::AVec{OHLC}; kw...) = Any[v], nothing
|
||||
|
||||
# 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...)
|
||||
ys, ymeta = convertToAnyVector(y; kw...)
|
||||
|
||||
# _debugMode.on && dumpcallstack()
|
||||
|
||||
mx = length(xs)
|
||||
my = length(ys)
|
||||
ret = Any[]
|
||||
|
||||
@ -116,6 +116,9 @@ end
|
||||
|
||||
# ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
nop() = nothing
|
||||
|
||||
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, idx::Int) = v
|
||||
|
||||
@ -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"
|
||||
function compareToReferenceImage(tmpfn, reffn)
|
||||
@eval import Gtk
|
||||
println("here000")
|
||||
# @eval import Gtk
|
||||
Gtk.gtk_main()
|
||||
println("huh0")
|
||||
sleep(2)
|
||||
|
||||
# add the images
|
||||
imgbox = Gtk.GtkBoxLeaf(:h)
|
||||
println("huh")
|
||||
push!(imgbox, makeImageWidget(tmpfn))
|
||||
println("huh2")
|
||||
push!(imgbox, makeImageWidget(reffn))
|
||||
|
||||
println("here00")
|
||||
|
||||
# add the buttons
|
||||
# doNothingButton = Gtk.GtkButtonLeaf("Skip")
|
||||
# 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?")
|
||||
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)
|
||||
|
||||
println("here1")
|
||||
|
||||
# now ask the question
|
||||
if Gtk.ask_dialog("Should we make this the new reference image?", "No", "Yes")
|
||||
replaceReferenceImage(tmpfn, reffn)
|
||||
end
|
||||
|
||||
println("here2")
|
||||
destroy(win)
|
||||
println("here3")
|
||||
|
||||
# # we'll wait on this condition
|
||||
# c = Condition()
|
||||
@ -156,13 +178,14 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, sigma = [1
|
||||
|
||||
catch err
|
||||
warn("Image did not match reference image $reffn. err: $err")
|
||||
showerror(Base.STDERR, err)
|
||||
# showerror(Base.STDERR, err)
|
||||
|
||||
if isinteractive()
|
||||
|
||||
# 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?")
|
||||
compareToReferenceImage(tmpfn, reffn)
|
||||
println("exited")
|
||||
return
|
||||
|
||||
else
|
||||
|
||||