tmake PyPlot optional - Granular.jl - Julia package for granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/Granular.jl
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit c0197122604cd76fc10c2000f11815191c4d542e
(DIR) parent 69b0d873e6ec27b9d3e9b95219640f742283445c
(HTM) Author: Anders Damsgaard <andersd@riseup.net>
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(-)
---
(DIR) diff --git a/REQUIRE b/REQUIRE
t@@ -1,5 +1,4 @@
julia 0.6
WriteVTK
NetCDF
-PyPlot
Documenter
(DIR) 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::Simulation;
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