tmake PyPlot optional - Granular.jl - Julia package for granular dynamics simul… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit c0197122604cd76fc10c2000f11815191c4d542e | |
parent 69b0d873e6ec27b9d3e9b95219640f742283445c | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 3 Oct 2017 14:35:09 -0400 | |
make PyPlot optional | |
Diffstat: | |
M REQUIRE | 1 - | |
M src/icefloe.jl | 9 ++++++++- | |
2 files changed, 8 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/REQUIRE b/REQUIRE | |
t@@ -1,5 +1,4 @@ | |
julia 0.6 | |
WriteVTK | |
NetCDF | |
-PyPlot | |
Documenter | |
diff --git a/src/icefloe.jl b/src/icefloe.jl | |
t@@ -1,5 +1,8 @@ | |
## Manage icefloes in the model | |
-import PyPlot | |
+if typeof(Pkg.installed("PyPlot")) == VersionNumber | |
+ import PyPlot | |
+ hasPyPlot = true | |
+end | |
export addIceFloeCylindrical! | |
""" | |
t@@ -694,6 +697,10 @@ function plotIceFloeSizeDistribution(simulation::Simulati… | |
skip_fixed::Bool = true, | |
log_y::Bool = true) | |
+ if !hasPyPlot | |
+ warn("Function not available because PyPlot is not installed") | |
+ return | |
+ end | |
diameters = Float64[] | |
for i=1:length(simulation.ice_floes) | |
if simulation.ice_floes[i].fixed && skip_fixed |