Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c798fe6822 | |||
| 5f4dfdd5d2 | |||
| 1f7043e02a | |||
| c651be7a12 |
@@ -12,6 +12,12 @@
|
||||
|
||||
## 0.9 (current master/dev)
|
||||
|
||||
#### 0.9.3
|
||||
|
||||
- support pdf and eps in plotlyjs backend
|
||||
- allow curly after grid: `@layout [a b; grid(4,4){0.8h}]`
|
||||
- add_backend redesign
|
||||
|
||||
#### 0.9.2
|
||||
|
||||
- glvisualize backend (@SimonDanisch)
|
||||
|
||||
+7
-2
@@ -31,8 +31,12 @@ include("backends/web.jl")
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
add_backend(pkg::Symbol) = add_backend(_backend_instance(pkg))
|
||||
add_backend(b::AbstractBackend) = warn("No custom install defined for $(backend_name(b))")
|
||||
function add_backend(pkg::Symbol)
|
||||
info("To do a standard install of $pkg, copy and run this:\n\n")
|
||||
println(add_backend_string(_backend_instance(pkg)))
|
||||
println()
|
||||
end
|
||||
add_backend_string(b::AbstractBackend) = warn("No custom install defined for $(backend_name(b))")
|
||||
|
||||
# don't do anything as a default
|
||||
_create_backend_figure(plt::Plot) = nothing
|
||||
@@ -147,6 +151,7 @@ function backend()
|
||||
_initialize_backend(inst)
|
||||
catch err
|
||||
warn("Couldn't initialize $sym. (might need to install it?)")
|
||||
add_backend(sym)
|
||||
rethrow(err)
|
||||
end
|
||||
|
||||
|
||||
@@ -75,14 +75,15 @@ function _initialize_backend(::GLVisualizeBackend; kw...)
|
||||
end
|
||||
end
|
||||
|
||||
function add_backend(::GLVisualizeBackend)
|
||||
if !is_installed("GLVisualize")
|
||||
function add_backend_string(b::GLVisualizeBackend)
|
||||
"""
|
||||
if !Plots.is_installed("GLVisualize")
|
||||
Pkg.add("GLVisualize")
|
||||
end
|
||||
if !is_installed("Contour")
|
||||
if !Plots.is_installed("Contour")
|
||||
Pkg.add("Contour")
|
||||
end
|
||||
if !is_installed("GLPlot")
|
||||
if !Plots.is_installed("GLPlot")
|
||||
Pkg.add("GLPlot")
|
||||
end
|
||||
|
||||
@@ -92,11 +93,12 @@ function add_backend(::GLVisualizeBackend)
|
||||
"GLVisualize", "GeometryTypes", "FixedSizeArrays",
|
||||
"FreeType", "GLPlot"
|
||||
]
|
||||
warn("Running Pkg.checkout(\"$pkg\"). To revert, run Pkg.free(\"$pkg\")")
|
||||
warn("Running Pkg.checkout(\"\$pkg\"). To revert, run Pkg.free(\"\$pkg\")")
|
||||
Pkg.checkout(pkg)
|
||||
end
|
||||
warn("Running Pkg.checkout(\"Reactive\", \"sd/betterstop\"). To revert, run Pkg.free(\"Reactive\")")
|
||||
Pkg.checkout("Reactive", "sd/betterstop")
|
||||
"""
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -42,6 +42,12 @@ const _gr_marker = _allMarkers
|
||||
const _gr_scale = [:identity, :log10]
|
||||
is_marker_supported(::GRBackend, shape::Shape) = true
|
||||
|
||||
function add_backend_string(::GRBackend)
|
||||
"""
|
||||
Pkg.add("GR")
|
||||
Pkg.build("GR")
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::GRBackend; kw...)
|
||||
@eval begin
|
||||
|
||||
@@ -40,6 +40,12 @@ const _pgfplots_scale = [:identity, :ln, :log2, :log10]
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend_string(::PGFPlotsBackend)
|
||||
"""
|
||||
Pkg.add("PGFPlots")
|
||||
Pkg.build("PGFPlots")
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::PGFPlotsBackend; kw...)
|
||||
@eval begin
|
||||
|
||||
@@ -47,8 +47,10 @@ is_subplot_supported(::PlotlyBackend) = true
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend(::PlotlyBackend)
|
||||
function add_backend_string(::PlotlyBackend)
|
||||
"""
|
||||
Pkg.build("Plots")
|
||||
"""
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -10,15 +10,17 @@ const _plotlyjs_scale = _plotly_scale
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function add_backend(::PlotlyJSBackend)
|
||||
if !is_installed("PlotlyJS")
|
||||
function add_backend_string(::PlotlyJSBackend)
|
||||
"""
|
||||
if !Plots.is_installed("PlotlyJS")
|
||||
Pkg.add("PlotlyJS")
|
||||
end
|
||||
if !is_installed("Rsvg")
|
||||
if !Plots.is_installed("Rsvg")
|
||||
Pkg.add("Rsvg")
|
||||
end
|
||||
@eval import Blink
|
||||
import Blink
|
||||
Blink.AtomShell.install()
|
||||
"""
|
||||
end
|
||||
|
||||
|
||||
@@ -78,11 +80,14 @@ function _show(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyJSBackend})
|
||||
show(io, MIME("text/html"), plt.o)
|
||||
end
|
||||
|
||||
function _show(io::IO, ::MIME"image/png", plt::Plot{PlotlyJSBackend})
|
||||
tmpfn = tempname() * ".png"
|
||||
function plotlyjs_save_hack(io::IO, plt::Plot{PlotlyJSBackend}, ext::String)
|
||||
tmpfn = tempname() * "." * ext
|
||||
PlotlyJS.savefig(plt.o, tmpfn)
|
||||
write(io, read(open(tmpfn)))
|
||||
end
|
||||
_show(io::IO, ::MIME"image/png", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "png")
|
||||
_show(io::IO, ::MIME"application/pdf", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "pdf")
|
||||
_show(io::IO, ::MIME"image/eps", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "eps")
|
||||
|
||||
function _display(plt::Plot{PlotlyJSBackend})
|
||||
display(plt.o)
|
||||
|
||||
@@ -48,13 +48,15 @@ is_marker_supported(::PyPlotBackend, shape::Shape) = true
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend(::PyPlotBackend)
|
||||
if !is_installed("PyPlot")
|
||||
withenv("PYTHON" => "") do
|
||||
Pkg.add("PyPlot")
|
||||
Pkg.build("PyPlot")
|
||||
end
|
||||
function add_backend_string(::PyPlotBackend)
|
||||
"""
|
||||
if !Plots.is_installed("PyPlot")
|
||||
Pkg.add("PyPlot")
|
||||
end
|
||||
withenv("PYTHON" => "") do
|
||||
Pkg.build("PyPlot")
|
||||
end
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::PyPlotBackend)
|
||||
|
||||
@@ -28,6 +28,13 @@ warnOnUnsupported_args(::UnicodePlotsBackend, d::KW) = nothing
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend_string(::UnicodePlotsBackend)
|
||||
"""
|
||||
Pkg.add("UnicodePlots")
|
||||
Pkg.build("UnicodePlots")
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::UnicodePlotsBackend; kw...)
|
||||
@eval begin
|
||||
import UnicodePlots
|
||||
|
||||
+20
-2
@@ -503,6 +503,12 @@ function build_layout(layout::GridLayout, n::Integer)
|
||||
i += 1
|
||||
elseif isa(l, GridLayout)
|
||||
# sub-grid
|
||||
if get(l.attr, :width, :auto) != :auto
|
||||
layout.widths[c] = attr(l,:width)
|
||||
end
|
||||
if get(l.attr, :height, :auto) != :auto
|
||||
layout.heights[r] = attr(l,:height)
|
||||
end
|
||||
l, sps, m = build_layout(l, n-i)
|
||||
append!(subplots, sps)
|
||||
merge!(spmap, m)
|
||||
@@ -539,6 +545,12 @@ function build_layout(layout::GridLayout, numsp::Integer, plts::AVec{Plot})
|
||||
i += length(plt.subplots)
|
||||
elseif isa(l, GridLayout)
|
||||
# sub-grid
|
||||
if get(l.attr, :width, :auto) != :auto
|
||||
layout.widths[c] = attr(l,:width)
|
||||
end
|
||||
if get(l.attr, :height, :auto) != :auto
|
||||
layout.heights[r] = attr(l,:height)
|
||||
end
|
||||
l, sps, m = build_layout(l, numsp-i, plts)
|
||||
append!(subplots, sps)
|
||||
merge!(spmap, m)
|
||||
@@ -635,12 +647,18 @@ function create_grid_vcat(expr::Expr)
|
||||
end
|
||||
|
||||
function create_grid_curly(expr::Expr)
|
||||
s = expr.args[1]
|
||||
kw = KW()
|
||||
for (i,arg) in enumerate(expr.args[2:end])
|
||||
add_layout_pct!(kw, arg, i, length(expr.args)-1)
|
||||
end
|
||||
:(EmptyLayout(label = $(QuoteNode(s)), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto)))))
|
||||
s = expr.args[1]
|
||||
if isa(s, Expr) && s.head == :call && s.args[1] == :grid
|
||||
create_grid(:(grid($(s.args[2:end]...), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto))))))
|
||||
elseif isa(s, Symbol)
|
||||
:(EmptyLayout(label = $(QuoteNode(s)), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto)))))
|
||||
else
|
||||
error("Unknown use of curly brackets: $expr")
|
||||
end
|
||||
end
|
||||
|
||||
function create_grid(s::Symbol)
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ default(size=(500,300))
|
||||
# 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)
|
||||
|
||||
const _current_plots_version = v"0.9.3"
|
||||
const _current_plots_version = v"0.9.4"
|
||||
|
||||
|
||||
function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], eps = 1e-2)
|
||||
|
||||
Reference in New Issue
Block a user