From c7191ecc47ed361d393ac76f5c9ff00b077e285f Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Thu, 3 Mar 2016 15:06:00 +0100 Subject: [PATCH] Fix issue #7 --- replot/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/replot/__init__.py b/replot/__init__.py index 559bffb..fbfb4fc 100644 --- a/replot/__init__.py +++ b/replot/__init__.py @@ -4,8 +4,15 @@ of Matplotlib. """ import collections import math +import os import shutil +import matplotlib as mpl +# Use "agg" backend automatically if no display is available. +try: + os.environ["DISPLAY"] +except KeyError: + mpl.use("agg") import matplotlib.pyplot as plt import numpy as np import seaborn.apionly as sns