From b0faa773183cf6fefb38caf9586004220751b303 Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Tue, 11 Apr 2017 13:38:44 +0200
Subject: [PATCH] Update matplotlib dependency to prevent confusing error
 message

Requirement is matplotlib>=1.4 in order to use the style package. Make the
default context ggplot (available in 1.4) and add an error message to
help the user when they have selected one which does not exist.
---
 README.md                      | 2 +-
 pyfstat/mcmc_based_searches.py | 7 ++++++-
 requirements.txt               | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index bbe2d23..fb17b69 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ $ git clone git@gitlab.aei.uni-hannover.de:GregAshton/PyFstat.git
 `pyfstat` makes uses the following external python modules:
 
 * [numpy](http://www.numpy.org/)
-* [matplotlib](http://matplotlib.org/)
+* [matplotlib](http://matplotlib.org/) >= 1.4
 * [scipy](https://www.scipy.org/)
 * [emcee](http://dan.iel.fm/emcee/current/)
 * [corner](https://pypi.python.org/pypi/corner/)
diff --git a/pyfstat/mcmc_based_searches.py b/pyfstat/mcmc_based_searches.py
index aae72a6..7bd26f0 100644
--- a/pyfstat/mcmc_based_searches.py
+++ b/pyfstat/mcmc_based_searches.py
@@ -771,9 +771,14 @@ class MCMCSearch(core.BaseSearchClass):
     def _plot_walkers(self, sampler, symbols=None, alpha=0.4, color="k",
                       temp=0, lw=0.1, nprod=0, add_det_stat_burnin=False,
                       fig=None, axes=None, xoffset=0, plot_det_stat=False,
-                      context='classic', subtractions=None, labelpad=0.05):
+                      context='ggplot', subtractions=None, labelpad=0.05):
         """ Plot all the chains from a sampler """
 
+        if context not in plt.style.available:
+            raise ValueError((
+                'The requested context {} is not available; please select a'
+                ' context from `plt.style.available`').format(context))
+
         if np.ndim(axes) > 1:
             axes = axes.flatten()
 
diff --git a/requirements.txt b/requirements.txt
index c34c508..02f6554 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
 numpy
-matplotlib
+matplotlib>=1.4
 scipy
 emcee
 corner
-- 
GitLab