working on colors and tests
3
.gitignore
vendored
@ -2,4 +2,5 @@
|
|||||||
*.jl.*.cov
|
*.jl.*.cov
|
||||||
*.jl.mem
|
*.jl.mem
|
||||||
.DS_Store
|
.DS_Store
|
||||||
examples/.ipynb_checkpoints/*
|
examples/.ipynb_checkpoints/*
|
||||||
|
examples/meetup/.ipynb_checkpoints/*
|
||||||
|
|||||||
@ -633,16 +633,16 @@ function buildGadflySubplotContext(subplt::Subplot)
|
|||||||
Gadfly.vstack(rows...)
|
Gadfly.vstack(rows...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function setGadflyDisplaySize(w,h)
|
setGadflyDisplaySize(w,h) = Compose.set_default_graphic_size(w * Compose.px, h * Compose.px)
|
||||||
Compose.set_default_graphic_size(w * Compose.px, h * Compose.px)
|
setGadflyDisplaySize(plt::Plot) = setGadflyDisplaySize(plt.initargs[:size]...)
|
||||||
end
|
setGadflyDisplaySize(subplt::Subplot) = setGadflyDisplaySize(getinitargs(subplt, 1)[:size]...)
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
function dowritemime{P<:GadflyOrImmerse}(io::IO, func, plt::PlottingObject{P})
|
function dowritemime{P<:GadflyOrImmerse}(io::IO, func, plt::PlottingObject{P})
|
||||||
gplt = getGadflyContext(plt)
|
gplt = getGadflyContext(plt)
|
||||||
setGadflyDisplaySize(plt.initargs[:size]...)
|
# setGadflyDisplaySize(plt.initargs[:size]...)
|
||||||
|
setGadflyDisplaySize(plt)
|
||||||
Gadfly.draw(func(io, Compose.default_graphic_width, Compose.default_graphic_height), gplt)
|
Gadfly.draw(func(io, Compose.default_graphic_width, Compose.default_graphic_height), gplt)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function Base.display(::PlotsDisplay, subplt::Subplot{GadflyPackage})
|
function Base.display(::PlotsDisplay, subplt::Subplot{GadflyPackage})
|
||||||
setGadflyDisplaySize(subplt.initargs[1][:size]...)
|
setGadflyDisplaySize(getinitargs(subplt,1)[:size]...)
|
||||||
ctx = buildGadflySubplotContext(subplt)
|
ctx = buildGadflySubplotContext(subplt)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -92,7 +92,7 @@ function buildSubplotObject!(subplt::Subplot{ImmersePackage}, isbefore::Bool)
|
|||||||
isbefore && return false
|
isbefore && return false
|
||||||
|
|
||||||
# create the Gtk window with vertical box vsep
|
# create the Gtk window with vertical box vsep
|
||||||
d = subplt.initargs[1]
|
d = getinitargs(subplt,1)
|
||||||
w,h = d[:size]
|
w,h = d[:size]
|
||||||
vsep = Gtk.GtkBoxLeaf(:v)
|
vsep = Gtk.GtkBoxLeaf(:v)
|
||||||
win = Gtk.GtkWindowLeaf(vsep, d[:windowtitle], w, h)
|
win = Gtk.GtkWindowLeaf(vsep, d[:windowtitle], w, h)
|
||||||
|
|||||||
@ -497,8 +497,8 @@ end
|
|||||||
function buildSubplotObject!(subplt::Subplot{PyPlotPackage}, isbefore::Bool)
|
function buildSubplotObject!(subplt::Subplot{PyPlotPackage}, isbefore::Bool)
|
||||||
l = subplt.layout
|
l = subplt.layout
|
||||||
|
|
||||||
w,h = map(px2inch, subplt.initargs[1][:size])
|
w,h = map(px2inch, getinitargs(subplt,1)[:size])
|
||||||
bgcolor = getPyPlotColor(subplt.initargs[1][:background_color])
|
bgcolor = getPyPlotColor(getinitargs(subplt,1)[:background_color])
|
||||||
fig = PyPlot.figure(; figsize = (w,h), facecolor = bgcolor, dpi = 96)
|
fig = PyPlot.figure(; figsize = (w,h), facecolor = bgcolor, dpi = 96)
|
||||||
|
|
||||||
nr = nrows(l)
|
nr = nrows(l)
|
||||||
|
|||||||
@ -278,7 +278,7 @@ function buildSubplotObject!(subplt::Subplot{QwtPackage}, isbefore::Bool)
|
|||||||
# i += rowcnt
|
# i += rowcnt
|
||||||
# end
|
# end
|
||||||
subplt.o = Qwt.vsplitter(rows...)
|
subplt.o = Qwt.vsplitter(rows...)
|
||||||
Qwt.resizewidget(subplt.o, subplt.initargs[1][:size]...)
|
Qwt.resizewidget(subplt.o, getinitargs(subplt,1)[:size]...)
|
||||||
Qwt.moveToLastScreen(subplt.o) # hack so it goes to my center monitor... sorry
|
Qwt.moveToLastScreen(subplt.o) # hack so it goes to my center monitor... sorry
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -105,6 +105,8 @@ colorscheme(m::AMat) = size(m,1) == 1 ? map(colorscheme, m) : [colorscheme(m[:,i
|
|||||||
colorscheme(c::Colorant) = ColorWrapper(c)
|
colorscheme(c::Colorant) = ColorWrapper(c)
|
||||||
|
|
||||||
const _rainbowColors = [colorant"blue", colorant"purple", colorant"green", colorant"orange", colorant"red"]
|
const _rainbowColors = [colorant"blue", colorant"purple", colorant"green", colorant"orange", colorant"red"]
|
||||||
|
const _testColors = [colorant"darkblue", colorant"blueviolet", colorant"darkcyan",colorant"green",
|
||||||
|
darken(colorant"yellow",0.3), colorant"orange", darken(colorant"red",0.2)]
|
||||||
|
|
||||||
@compat const _gradients = Dict(
|
@compat const _gradients = Dict(
|
||||||
:blues => [colorant"lightblue", colorant"darkblue"],
|
:blues => [colorant"lightblue", colorant"darkblue"],
|
||||||
@ -117,6 +119,8 @@ const _rainbowColors = [colorant"blue", colorant"purple", colorant"green", color
|
|||||||
:rainbow => _rainbowColors,
|
:rainbow => _rainbowColors,
|
||||||
:lightrainbow => map(lighten, _rainbowColors),
|
:lightrainbow => map(lighten, _rainbowColors),
|
||||||
:darkrainbow => map(darken, _rainbowColors),
|
:darkrainbow => map(darken, _rainbowColors),
|
||||||
|
:darktest => _testColors,
|
||||||
|
:lighttest => map(c -> lighten(c, 0.3), _testColors),
|
||||||
)
|
)
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
@ -305,7 +309,8 @@ end
|
|||||||
function getPaletteUsingGradientSymbol(palette, bgcolor::Colorant, numcolors::Int = _defaultNumColors) #; gradientsym::Symbol = :auto)
|
function getPaletteUsingGradientSymbol(palette, bgcolor::Colorant, numcolors::Int = _defaultNumColors) #; gradientsym::Symbol = :auto)
|
||||||
# @show gradientsym
|
# @show gradientsym
|
||||||
if palette == :auto
|
if palette == :auto
|
||||||
grad = ColorGradient(_gradients[isdark(bgcolor) ? :lightrainbow : :darkrainbow])
|
# grad = ColorGradient(_gradients[isdark(bgcolor) ? :lightrainbow : :darkrainbow])
|
||||||
|
grad = ColorGradient(_gradients[isdark(bgcolor) ? :lighttest : :darktest])
|
||||||
# elseif typeof(palette) <: AVec || typeof(palette) <: ColorGradient
|
# elseif typeof(palette) <: AVec || typeof(palette) <: ColorGradient
|
||||||
# grad = ColorGradient(palette)
|
# grad = ColorGradient(palette)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -167,11 +167,14 @@ function subplot(args...; kw...)
|
|||||||
# initialize the individual plots
|
# initialize the individual plots
|
||||||
pkg = backend()
|
pkg = backend()
|
||||||
plts = Plot[]
|
plts = Plot[]
|
||||||
ds = Dict[]
|
# ds = Dict[]
|
||||||
for i in 1:length(layout)
|
for i in 1:length(layout)
|
||||||
push!(ds, getPlotArgs(pkg, d, i))
|
di = getPlotArgs(pkg, d, i)
|
||||||
ds[i][:subplot] = true
|
di[:subplot] = true
|
||||||
push!(plts, plot(pkg; ds[i]...))
|
push!(plts, plot(pkg; di...))
|
||||||
|
# push!(ds, getPlotArgs(pkg, d, i))
|
||||||
|
# ds[i][:subplot] = true
|
||||||
|
# push!(plts, plot(pkg; ds[i]...))
|
||||||
end
|
end
|
||||||
|
|
||||||
# tmpd = getPlotKeywordArgs(pkg, kw, 1, 0) # TODO: this should happen in the plot creation loop... think... what if we want to set a title per subplot??
|
# tmpd = getPlotKeywordArgs(pkg, kw, 1, 0) # TODO: this should happen in the plot creation loop... think... what if we want to set a title per subplot??
|
||||||
@ -181,7 +184,8 @@ function subplot(args...; kw...)
|
|||||||
# # tmpd[:show] = shouldShow
|
# # tmpd[:show] = shouldShow
|
||||||
|
|
||||||
# create the object and do the plotting
|
# create the object and do the plotting
|
||||||
subplt = Subplot(nothing, plts, pkg, length(layout), 0, layout, ds, false, false, false, (r,c) -> (nothing,nothing))
|
# subplt = Subplot(nothing, plts, pkg, length(layout), 0, layout, ds, false, false, false, (r,c) -> (nothing,nothing))
|
||||||
|
subplt = Subplot(nothing, plts, pkg, length(layout), 0, layout, d, false, false, false, (r,c) -> (nothing,nothing))
|
||||||
subplot!(subplt, args...; kw...)
|
subplot!(subplt, args...; kw...)
|
||||||
|
|
||||||
subplt
|
subplt
|
||||||
|
|||||||
@ -38,7 +38,8 @@ type Subplot{T<:PlottingPackage, L<:SubplotLayout} <: PlottingObject{T}
|
|||||||
p::Int # number of plots
|
p::Int # number of plots
|
||||||
n::Int # number of series
|
n::Int # number of series
|
||||||
layout::L
|
layout::L
|
||||||
initargs::Vector{Dict}
|
# initargs::Vector{Dict}
|
||||||
|
initargs::Dict
|
||||||
initialized::Bool
|
initialized::Bool
|
||||||
linkx::Bool
|
linkx::Bool
|
||||||
linky::Bool
|
linky::Bool
|
||||||
|
|||||||
@ -6,3 +6,5 @@ FactCheck
|
|||||||
PyPlot
|
PyPlot
|
||||||
UnicodePlots
|
UnicodePlots
|
||||||
Gadfly
|
Gadfly
|
||||||
|
Images
|
||||||
|
ImageMagick
|
||||||
|
|||||||
@ -16,8 +16,8 @@ include("../docs/example_generation.jl")
|
|||||||
# plt
|
# plt
|
||||||
# end
|
# end
|
||||||
|
|
||||||
using Plots
|
using Plots, FactCheck
|
||||||
import Images, Gtk, ImageMagick
|
import Images, ImageMagick
|
||||||
|
|
||||||
function makeImageWidget(fn)
|
function makeImageWidget(fn)
|
||||||
img = Gtk.GtkImageLeaf(fn)
|
img = Gtk.GtkImageLeaf(fn)
|
||||||
@ -29,11 +29,14 @@ function makeImageWidget(fn)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function replaceReferenceImage(tmpfn, reffn)
|
function replaceReferenceImage(tmpfn, reffn)
|
||||||
println("cp $tmpfn $reffn")
|
cmd = `cp $tmpfn $reffn`
|
||||||
|
run(cmd)
|
||||||
|
info("Replaced reference image with: $cmd")
|
||||||
end
|
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
|
||||||
|
|
||||||
# add the images
|
# add the images
|
||||||
imgbox = Gtk.GtkBoxLeaf(:h)
|
imgbox = Gtk.GtkBoxLeaf(:h)
|
||||||
@ -51,7 +54,8 @@ function compareToReferenceImage(tmpfn, reffn)
|
|||||||
box = Gtk.GtkBoxLeaf(:v)
|
box = Gtk.GtkBoxLeaf(:v)
|
||||||
push!(box, imgbox)
|
push!(box, imgbox)
|
||||||
push!(box, btnbox)
|
push!(box, btnbox)
|
||||||
win = Gtk.GtkWindowLeaf(Gtk.GtkFrameLeaf(box))
|
win = Gtk.GtkWindowLeaf("Should we make this the new reference image?")
|
||||||
|
push!(win, Gtk.GtkFrameLeaf(box))
|
||||||
|
|
||||||
# we'll wait on this condition
|
# we'll wait on this condition
|
||||||
c = Condition()
|
c = Condition()
|
||||||
@ -76,7 +80,7 @@ end
|
|||||||
# TODO: use julia's Condition type and the wait() and notify() functions to initialize a Window, then wait() on a condition that
|
# TODO: use julia's Condition type and the wait() and notify() functions to initialize a Window, then wait() on a condition that
|
||||||
# is referenced in a button press callback (the button clicked callback will call notify() on that condition)
|
# is referenced in a button press callback (the button clicked callback will call notify() on that condition)
|
||||||
|
|
||||||
function image_comparison_tests(pkg::Symbol, idx::Int; debug = true, sigma = [0,0], eps = 1e-3)
|
function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, sigma = [1,1], eps = 1e-3)
|
||||||
|
|
||||||
# first
|
# first
|
||||||
Plots._debugMode.on = debug
|
Plots._debugMode.on = debug
|
||||||
@ -84,7 +88,10 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = true, sigma = [0,
|
|||||||
backend(pkg)
|
backend(pkg)
|
||||||
backend()
|
backend()
|
||||||
|
|
||||||
info("here: ", PlotExamples.examples[idx].exprs)
|
# ensure consistent results
|
||||||
|
srand(1234)
|
||||||
|
|
||||||
|
# run the example
|
||||||
map(eval, PlotExamples.examples[idx].exprs)
|
map(eval, PlotExamples.examples[idx].exprs)
|
||||||
|
|
||||||
# save the png
|
# save the png
|
||||||
@ -97,7 +104,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = true, sigma = [0,
|
|||||||
# reference image location
|
# reference image location
|
||||||
refdir = joinpath(Pkg.dir("Plots"), "test", "refimg", "v$(VERSION.major).$(VERSION.minor)", string(pkg))
|
refdir = joinpath(Pkg.dir("Plots"), "test", "refimg", "v$(VERSION.major).$(VERSION.minor)", string(pkg))
|
||||||
try
|
try
|
||||||
mkdir(refdir)
|
run(`mkdir -p $refdir`)
|
||||||
catch err
|
catch err
|
||||||
display(err)
|
display(err)
|
||||||
end
|
end
|
||||||
@ -105,7 +112,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = true, sigma = [0,
|
|||||||
|
|
||||||
try
|
try
|
||||||
|
|
||||||
info("Comparing $tmpfn to reference $reffn")
|
# info("Comparing $tmpfn to reference $reffn")
|
||||||
|
|
||||||
# load the reference image
|
# load the reference image
|
||||||
refimg = Images.load(reffn)
|
refimg = Images.load(reffn)
|
||||||
@ -115,10 +122,16 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = true, sigma = [0,
|
|||||||
# to blur together when comparing images
|
# to blur together when comparing images
|
||||||
Images.@test_approx_eq_sigma_eps(tmpimg, refimg, sigma, eps)
|
Images.@test_approx_eq_sigma_eps(tmpimg, refimg, sigma, eps)
|
||||||
|
|
||||||
|
# we passed!
|
||||||
|
info("Reference image $reffn matches")
|
||||||
|
return true
|
||||||
|
|
||||||
catch ex
|
catch ex
|
||||||
|
warn("Image did not match reference image $reffn")
|
||||||
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?")
|
||||||
compareToReferenceImage(tmpfn, reffn)
|
compareToReferenceImage(tmpfn, reffn)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -131,13 +144,9 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = true, sigma = [0,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function image_comparison_tests(pkg::Symbol; debug = false)
|
function image_comparison_tests(pkg::Symbol; skip = [], debug = false, sigma = [1,1], eps = 1e-3)
|
||||||
for i in 1:length(PlotExamples.examples)
|
for i in 1:length(PlotExamples.examples)
|
||||||
# try
|
i in skip && continue
|
||||||
image_comparison_tests(pkgname, i, debug=debug)
|
@fact image_comparison_tests(pkg, i, debug=debug, sigma=sigma, eps=eps) --> true
|
||||||
# catch ex
|
|
||||||
# # TODO: put error info into markdown?
|
|
||||||
# warn("Example $pkgname:$i:$(examples[i].header) failed with: $ex")
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
BIN
test/refimg/v0.4/gadfly/ref1.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
test/refimg/v0.4/gadfly/ref10.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
test/refimg/v0.4/gadfly/ref11.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
test/refimg/v0.4/gadfly/ref12.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
test/refimg/v0.4/gadfly/ref13.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
test/refimg/v0.4/gadfly/ref14.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
test/refimg/v0.4/gadfly/ref15.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
test/refimg/v0.4/gadfly/ref16.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
test/refimg/v0.4/gadfly/ref17.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
test/refimg/v0.4/gadfly/ref18.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
test/refimg/v0.4/gadfly/ref2.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
test/refimg/v0.4/gadfly/ref20.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
test/refimg/v0.4/gadfly/ref21.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
test/refimg/v0.4/gadfly/ref3.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
test/refimg/v0.4/gadfly/ref4.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
test/refimg/v0.4/gadfly/ref5.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
test/refimg/v0.4/gadfly/ref6.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
test/refimg/v0.4/gadfly/ref7.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
test/refimg/v0.4/gadfly/ref8.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
test/refimg/v0.4/gadfly/ref9.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
145
test/runtests.jl
@ -3,11 +3,17 @@ module PlotsTests
|
|||||||
using Plots
|
using Plots
|
||||||
using FactCheck
|
using FactCheck
|
||||||
|
|
||||||
|
# note: wrap first include in a try block because of the ImageMagick init_deps bug
|
||||||
|
try
|
||||||
|
include("imgcomp.jl")
|
||||||
|
end
|
||||||
|
include("imgcomp.jl")
|
||||||
|
|
||||||
# don't actually show the plots
|
# don't actually show the plots
|
||||||
srand(1234)
|
srand(1234)
|
||||||
|
|
||||||
# note: we wrap in a try block so that the tests only run if we have the backend installed
|
# note: we wrap in a try block so that the tests only run if we have the backend installed
|
||||||
try
|
# try
|
||||||
Pkg.installed("Gadfly")
|
Pkg.installed("Gadfly")
|
||||||
gadfly()
|
gadfly()
|
||||||
backend()
|
backend()
|
||||||
@ -28,60 +34,55 @@ try
|
|||||||
|
|
||||||
# plot(x::AMat, y::AMat; kw...) # multiple lines (one per column of x/y... will assert size(x) == size(y))
|
# plot(x::AMat, y::AMat; kw...) # multiple lines (one per column of x/y... will assert size(x) == size(y))
|
||||||
@fact plot!(rand(10,3), rand(10,3)) --> not(nothing)
|
@fact plot!(rand(10,3), rand(10,3)) --> not(nothing)
|
||||||
# @fact_throws plot!(rand(10,3), rand(10,2))
|
|
||||||
|
|
||||||
|
image_comparison_tests(:gadfly, skip=[19])
|
||||||
|
|
||||||
# plot(x::AVec, y::AVec{AVec}; kw...) # multiple lines, will assert length(x) == length(y[i])
|
|
||||||
|
|
||||||
|
|
||||||
# plot(x::AVec{AVec}, y::AVec{AVec}; kw...) # multiple lines, will assert length(x[i]) == length(y[i])
|
|
||||||
# plot(n::Integer; kw...) # n lines, all empty (for updating plots)
|
|
||||||
end
|
end
|
||||||
catch err
|
# catch err
|
||||||
warn("Skipped Gadfly due to: ", string(err))
|
# warn("Skipped Gadfly due to: ", string(err))
|
||||||
end
|
# end
|
||||||
|
|
||||||
# note: we wrap in a try block so that the tests only run if we have the backend installed
|
# # note: we wrap in a try block so that the tests only run if we have the backend installed
|
||||||
try
|
# try
|
||||||
Pkg.installed("Qwt")
|
# Pkg.installed("Qwt")
|
||||||
qwt()
|
# qwt()
|
||||||
backend()
|
# backend()
|
||||||
facts("Qwt") do
|
# facts("Qwt") do
|
||||||
@fact backend(:qwt) --> Plots.QwtPackage()
|
# @fact backend(:qwt) --> Plots.QwtPackage()
|
||||||
@fact backend() --> Plots.QwtPackage()
|
# @fact backend() --> Plots.QwtPackage()
|
||||||
@fact typeof(plot(1:10)) --> Plots.Plot{Plots.QwtPackage}
|
# @fact typeof(plot(1:10)) --> Plots.Plot{Plots.QwtPackage}
|
||||||
|
|
||||||
# plot(y::AVec; kw...) # one line... x = 1:length(y)
|
# # plot(y::AVec; kw...) # one line... x = 1:length(y)
|
||||||
@fact plot(1:10) --> not(nothing)
|
# @fact plot(1:10) --> not(nothing)
|
||||||
@fact length(current().o.lines) --> 1
|
# @fact length(current().o.lines) --> 1
|
||||||
|
|
||||||
# plot(x::AVec, f::Function; kw...) # one line, y = f(x)
|
# # plot(x::AVec, f::Function; kw...) # one line, y = f(x)
|
||||||
@fact plot(1:10, sin) --> not(nothing)
|
# @fact plot(1:10, sin) --> not(nothing)
|
||||||
@fact current().o.lines[1].y --> sin(collect(1:10))
|
# @fact current().o.lines[1].y --> sin(collect(1:10))
|
||||||
|
|
||||||
# plot(x::AMat, f::Function; kw...) # multiple lines, yᵢⱼ = f(xᵢⱼ)
|
# # plot(x::AMat, f::Function; kw...) # multiple lines, yᵢⱼ = f(xᵢⱼ)
|
||||||
@fact plot(rand(10,2), sin) --> not(nothing)
|
# @fact plot(rand(10,2), sin) --> not(nothing)
|
||||||
@fact length(current().o.lines) --> 2
|
# @fact length(current().o.lines) --> 2
|
||||||
|
|
||||||
# plot(y::AMat; kw...) # multiple lines (one per column of x), all sharing x = 1:size(y,1)
|
# # plot(y::AMat; kw...) # multiple lines (one per column of x), all sharing x = 1:size(y,1)
|
||||||
@fact plot!(rand(10,2)) --> not(nothing)
|
# @fact plot!(rand(10,2)) --> not(nothing)
|
||||||
@fact length(current().o.lines) --> 4
|
# @fact length(current().o.lines) --> 4
|
||||||
|
|
||||||
# plot(x::AVec, fs::AVec{Function}; kw...) # multiple lines, yᵢⱼ = fⱼ(xᵢ)
|
# # plot(x::AVec, fs::AVec{Function}; kw...) # multiple lines, yᵢⱼ = fⱼ(xᵢ)
|
||||||
@fact plot(1:10, Function[sin,cos]) --> not(nothing)
|
# @fact plot(1:10, Function[sin,cos]) --> not(nothing)
|
||||||
@fact current().o.lines[1].y --> sin(collect(1:10))
|
# @fact current().o.lines[1].y --> sin(collect(1:10))
|
||||||
@fact current().o.lines[2].y --> cos(collect(1:10))
|
# @fact current().o.lines[2].y --> cos(collect(1:10))
|
||||||
|
|
||||||
# plot(y::AVec{AVec}; kw...) # multiple lines, each with x = 1:length(y[i])
|
# # plot(y::AVec{AVec}; kw...) # multiple lines, each with x = 1:length(y[i])
|
||||||
@fact plot([11:20 ; rand(10)]) --> not(nothing)
|
# @fact plot([11:20 ; rand(10)]) --> not(nothing)
|
||||||
@fact current().o.lines[1].x[4] --> 4
|
# @fact current().o.lines[1].x[4] --> 4
|
||||||
@fact current().o.lines[1].y[4] --> 14
|
# @fact current().o.lines[1].y[4] --> 14
|
||||||
end
|
# end
|
||||||
catch err
|
# catch err
|
||||||
warn("Skipped Qwt due to: ", string(err))
|
# warn("Skipped Qwt due to: ", string(err))
|
||||||
end
|
# end
|
||||||
|
|
||||||
try
|
# try
|
||||||
Pkg.installed("PyPlot")
|
Pkg.installed("PyPlot")
|
||||||
pyplot()
|
pyplot()
|
||||||
backend()
|
backend()
|
||||||
@ -89,38 +90,40 @@ try
|
|||||||
@fact backend(:pyplot) --> Plots.PyPlotPackage()
|
@fact backend(:pyplot) --> Plots.PyPlotPackage()
|
||||||
@fact backend() --> Plots.PyPlotPackage()
|
@fact backend() --> Plots.PyPlotPackage()
|
||||||
@fact typeof(plot(1:10)) --> Plots.Plot{Plots.PyPlotPackage}
|
@fact typeof(plot(1:10)) --> Plots.Plot{Plots.PyPlotPackage}
|
||||||
|
|
||||||
|
image_comparison_tests(:pyplot, skip=[19])
|
||||||
end
|
end
|
||||||
catch err
|
# catch err
|
||||||
warn("Skipped PyPlot due to: ", string(err))
|
# warn("Skipped PyPlot due to: ", string(err))
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
|
||||||
try
|
# try
|
||||||
Pkg.installed("UnicodePlots")
|
# Pkg.installed("UnicodePlots")
|
||||||
unicodeplots()
|
# unicodeplots()
|
||||||
backend()
|
# backend()
|
||||||
facts("UnicodePlots") do
|
# facts("UnicodePlots") do
|
||||||
@fact backend(:unicodeplots) --> Plots.UnicodePlotsPackage()
|
# @fact backend(:unicodeplots) --> Plots.UnicodePlotsPackage()
|
||||||
@fact backend() --> Plots.UnicodePlotsPackage()
|
# @fact backend() --> Plots.UnicodePlotsPackage()
|
||||||
@fact typeof(plot(1:10)) --> Plots.Plot{Plots.UnicodePlotsPackage}
|
# @fact typeof(plot(1:10)) --> Plots.Plot{Plots.UnicodePlotsPackage}
|
||||||
end
|
# end
|
||||||
catch err
|
# catch err
|
||||||
warn("Skipped UnicodePlots due to: ", string(err))
|
# warn("Skipped UnicodePlots due to: ", string(err))
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
|
||||||
try
|
# try
|
||||||
Pkg.installed("Winston")
|
# Pkg.installed("Winston")
|
||||||
winston()
|
# winston()
|
||||||
backend()
|
# backend()
|
||||||
facts("Winston") do
|
# facts("Winston") do
|
||||||
@fact backend(:winston) --> Plots.WinstonPackage()
|
# @fact backend(:winston) --> Plots.WinstonPackage()
|
||||||
@fact backend() --> Plots.WinstonPackage()
|
# @fact backend() --> Plots.WinstonPackage()
|
||||||
@fact typeof(plot(1:10)) --> Plots.Plot{Plots.WinstonPackage}
|
# @fact typeof(plot(1:10)) --> Plots.Plot{Plots.WinstonPackage}
|
||||||
end
|
# end
|
||||||
catch err
|
# catch err
|
||||||
warn("Skipped Winston due to: ", string(err))
|
# warn("Skipped Winston due to: ", string(err))
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
|
||||||
FactCheck.exitstatus()
|
FactCheck.exitstatus()
|
||||||
|
|||||||