Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More plot packages support in RMarkdown document #124

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: JuliaCall
Type: Package
Title: Seamless Integration Between R and 'Julia'
Version: 0.17.1
Date: 2019-11-26
Version: 0.17.1.9999
Date: 2020-01-01
Authors@R: c(
person("Changcheng", "Li", , "cxl508@psu.edu", c("aut", "cre")),
person("Randy", "Lai", role = "ctb"),
Expand All @@ -25,8 +25,9 @@ Encoding: UTF-8
LazyData: true
Imports: utils,
Rcpp (>= 0.12.7),
knitr (>= 1.18)
RoxygenNote: 7.0.0
knitr (>= 1.18),
mime (>= 0.8)
RoxygenNote: 7.0.2
LinkingTo: Rcpp
NeedsCompilation: yes
ByteCompile: yes
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ export(julia_source)
export(julia_update_package)
export(plotsViewer)
import(Rcpp)
import(mime)
importFrom(knitr,knit_print)
useDynLib(JuliaCall)
1 change: 1 addition & 0 deletions R/JuliaCall.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
#' @docType package
#' @useDynLib JuliaCall
#' @import Rcpp
#' @import mime
#' @name JuliaCall
NULL
32 changes: 32 additions & 0 deletions inst/julia/display/RmdJulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,38 @@ function text_display(display::RmdDisplay, x)
text_display_in_R(s)
end

if julia07
using Requires
else
macro require_str() end
end

@require Plots="91a5bcdd-55d7-5caf-9e0b-520d859cae80" @eval begin

function display(display::RmdDisplay, x::Plots.Plot)
try
plot_display(display, x)
return
catch e;
end
try
text_display(display, x)
return
catch e;
end
throw(MethodError)
end

function plot_display(display::RmdDisplay, x::Plots.Plot)
path = rcopy(begin_plot_in_R())
mkpath(dirname(path))
Plots.savefig(x, path)
finish_plot_in_R()
end

end


function display(display::RmdDisplay, x)
try
if isa(x, Main.Plots.Plot)
Expand Down
5 changes: 5 additions & 0 deletions inst/julia/install_dependency.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ using Suppressor
if installed("RCall") == nothing
Pkg.add("RCall")
end;

if julia07 && installed("Requires") == nothing
Pkg.add("Requires")
using Requires
end;
5 changes: 5 additions & 0 deletions inst/julia/rebuildRCall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ end;

using Suppressor

if julia07 && installed("Requires") == nothing
Pkg.add("Requires")
using Requires
end;

if installed("RCall") == nothing
Pkg.add("RCall")
end;
Expand Down
4 changes: 2 additions & 2 deletions man/grapes-greater-than-J-grapes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.