66 lines
2.2 KiB
Plaintext
66 lines
2.2 KiB
Plaintext
diff --git a/src/resources/jupyter/lang/julia/setup.jl b/src/resources/jupyter/lang/julia/setup.jl
|
|
index 5d092330f..94687394f 100644
|
|
--- a/src/resources/jupyter/lang/julia/setup.jl
|
|
+++ b/src/resources/jupyter/lang/julia/setup.jl
|
|
@@ -28,30 +28,6 @@ end
|
|
fig_width = fig_width * fig_dpi
|
|
fig_height = fig_height * fig_dpi
|
|
|
|
-# Intialize Plots w/ default fig width/height
|
|
-try
|
|
- import Plots
|
|
-
|
|
- # Plots.jl doesn't support PDF output for versions < 1.28.1
|
|
- # so use png (if the DPI remains the default of 300 then set to 96)
|
|
- if (Plots._current_plots_version < v"1.28.1") & (fig_format == :pdf)
|
|
- Plots.gr(size=(fig_width, fig_height), fmt = :png, dpi = fig_dpi)
|
|
- else
|
|
- Plots.gr(size=(fig_width, fig_height), fmt = fig_format, dpi = fig_dpi)
|
|
- end
|
|
-catch e
|
|
- # @warn "Plots init" exception=(e, catch_backtrace())
|
|
-end
|
|
-
|
|
-# Initialize CairoMakie with default fig width/height
|
|
-try
|
|
- import CairoMakie
|
|
-
|
|
- CairoMakie.activate!(type = string(fig_format))
|
|
- CairoMakie.update_theme!(resolution=(fig_width, fig_height))
|
|
-catch e
|
|
- # @warn "CairoMakie init" exception=(e, catch_backtrace())
|
|
-end
|
|
|
|
# Set run_path if specified
|
|
try
|
|
@@ -71,29 +47,5 @@ function isinstalled(pkg::String)
|
|
any(x -> x.name == pkg && x.is_direct_dep, values(Pkg.dependencies()))
|
|
end
|
|
|
|
-# ojs_define
|
|
-if isinstalled("JSON") && isinstalled("DataFrames")
|
|
- import JSON, DataFrames
|
|
- global function ojs_define(; kwargs...)
|
|
- convert(x) = x
|
|
- convert(x::DataFrames.AbstractDataFrame) = Tables.rows(x)
|
|
- content = Dict("contents" => [Dict("name" => k, "value" => convert(v)) for (k, v) in kwargs])
|
|
- tag = "<script type='ojs-define'>$(JSON.json(content))</script>"
|
|
- IJulia.display(MIME("text/html"), tag)
|
|
- end
|
|
-elseif isinstalled("JSON")
|
|
- import JSON
|
|
- global function ojs_define(; kwargs...)
|
|
- content = Dict("contents" => [Dict("name" => k, "value" => v) for (k, v) in kwargs])
|
|
- tag = "<script type='ojs-define'>$(JSON.json(content))</script>"
|
|
- IJulia.display(MIME("text/html"), tag)
|
|
- end
|
|
-else
|
|
- global function ojs_define(; kwargs...)
|
|
- @warn "JSON package not available. Please install the JSON.jl package to use ojs_define."
|
|
- end
|
|
-end
|
|
-
|
|
-
|
|
# don't return kernel dependencies (b/c Revise should take care of dependencies)
|
|
nothing
|