mirror of https://github.com/mpastell/Weave.jl
Merge pull request #322 from JunoLab/avi/require
don't load Weave Plots submodules into user's modulepull/324/head
commit
d809ddf703
10
src/Weave.jl
10
src/Weave.jl
|
@ -6,14 +6,8 @@ using Highlights, Mustache, Requires
|
|||
const WEAVE_OPTION_NAME = "options" # TODO: rename to "weave_options"
|
||||
|
||||
function __init__()
|
||||
@require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Base.include(
|
||||
Main,
|
||||
joinpath(@__DIR__, "plots.jl"),
|
||||
)
|
||||
@require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" Base.include(
|
||||
Main,
|
||||
joinpath(@__DIR__, "gadfly.jl"),
|
||||
)
|
||||
@require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" include("plots.jl")
|
||||
@require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" include("gadfly.jl")
|
||||
end
|
||||
|
||||
@static @isdefined(isnothing) || begin
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
module GadflyPlots
|
||||
|
||||
import Gadfly
|
||||
import Weave
|
||||
using ..Weave, ..Gadfly
|
||||
|
||||
|
||||
try
|
||||
import Cairo
|
||||
using Cairo
|
||||
catch
|
||||
@warn("Cairo.jl is required to be installed to generate raster images")
|
||||
@warn "Cairo.jl is required to be installed to generate raster images"
|
||||
end
|
||||
|
||||
Gadfly.set_default_plot_format(:svg)
|
||||
|
@ -52,4 +53,5 @@ function Base.display(report::Weave.Report, m::MIME"image/svg+xml", p::Gadfly.Pl
|
|||
@warn("Can't save figure. Unsupported format, $format")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
module WeavePlots
|
||||
|
||||
using Base64
|
||||
import Plots
|
||||
import Weave
|
||||
using Base64, ..Plots, ..Weave
|
||||
|
||||
"""Pre-execute hooks to set the plot size for the chunk """
|
||||
|
||||
# Pre-execute hooks to set the plot size for the chunk
|
||||
function plots_set_size(chunk)
|
||||
w = chunk.options[:fig_width] * chunk.options[:dpi]
|
||||
h = chunk.options[:fig_height] * chunk.options[:dpi]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#Test for Gadfly with different chunk options and figure formatsusing Weave
|
||||
using Weave
|
||||
using Test
|
||||
# Test for Gadfly with different chunk options and figure formatsusing Weave
|
||||
|
||||
using Gadfly
|
||||
|
||||
|
||||
function test_gadfly(doctype, fig_ext)
|
||||
out = weave(joinpath(@__DIR__ , "documents/gadfly_formats_test.jnw"),
|
||||
|
@ -13,7 +14,6 @@ function test_gadfly(doctype, fig_ext)
|
|||
rm(out)
|
||||
end
|
||||
|
||||
##
|
||||
test_gadfly("github", ".png")
|
||||
test_gadfly("github", ".pdf")
|
||||
test_gadfly("github", ".svg")
|
||||
|
@ -24,7 +24,6 @@ test_gadfly("tex", ".png")
|
|||
test_gadfly("tex", ".ps")
|
||||
test_gadfly("tex", ".tex")
|
||||
|
||||
import Gadfly
|
||||
p = Gadfly.plot(x=1:10, y=1:10)
|
||||
@test showable(MIME"application/pdf"(), p) == true
|
||||
@test showable(MIME"application/png"(), p) == true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using Weave
|
||||
using Test
|
||||
using Plots
|
||||
|
||||
|
||||
function pljtest(source, resfile, doctype)
|
||||
weave("documents/$source", out_path = "documents/plotsjl/$resfile", doctype=doctype)
|
||||
|
|
Loading…
Reference in New Issue