diff --git a/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py b/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py
index dde40f7e2778b15088e45927cdd86bdb89abc408..ea1b37b586e7e7d103540c44526d419cbc619795 100644
--- a/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py
+++ b/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py
@@ -9,7 +9,7 @@ fitting; it serves as a gentle introduction to other fitting examples.
 from __future__ import print_function
 import bornagain as ba
 from bornagain import deg, angstrom, nm
-from matplotlib import pyplot as plt
+
 
 def get_sample():
     """
@@ -110,6 +110,7 @@ def plot(results):
     Draw results of several simulations on canvas
     """
 
+    from matplotlib import pyplot as plt
     plt.figure(figsize=(12.80, 10.24))
 
     for nplot, hist in results.items():
diff --git a/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py b/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py
index a45394bf42940ee382c1f5da1d1e9fbc96e73eea..ca63dd1ee498634c8ea4527bdf0dac2b7a68464d 100644
--- a/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py
+++ b/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py
@@ -4,7 +4,6 @@ All formfactors available in BornAgain in the Born Approximation
 import numpy
 import bornagain as ba
 from bornagain import deg, angstrom
-import matplotlib
 from matplotlib import pyplot as plt
 
 phi_min, phi_max = -2.0, 2.0
diff --git a/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py b/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py
index c967dbc93a1cb9a2ce968f7f12a204d8ed4615c8..dac9471bbf5638988fae7d5920a58cb52387d334 100644
--- a/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py
+++ b/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py
@@ -77,7 +77,6 @@ def plot(simulation):
     """
     Plots results for several selected layers
     """
-    import matplotlib
     from matplotlib import pyplot as plt
     fig = plt.figure(figsize=(12.80, 10.24))