Skip to content

Commit

Permalink
Force non interactive if no display
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerry Manoim committed Mar 10, 2020
1 parent e5d7a46 commit 57c03b3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
17 changes: 11 additions & 6 deletions alphalens/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import numpy as np
import pandas as pd
from scipy import stats
import statsmodels.api as sm

import matplotlib
if os.environ.get('DISPLAY', '') == '':
print('no display found. Using non-interactive Agg backend')
matplotlib.use('Agg')
import seaborn as sns
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from matplotlib.ticker import ScalarFormatter
import matplotlib.cm as cm # noqa: E402
import matplotlib.pyplot as plt # noqa: E402
from matplotlib.ticker import ScalarFormatter # noqa: E402

from functools import wraps
from functools import wraps # noqa: E402

from . import utils
from . import performance as perf
from . import utils # noqa: E402
from . import performance as perf # noqa: E402

DECIMAL_TO_BPS = 10000

Expand Down
23 changes: 13 additions & 10 deletions alphalens/tears.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import pandas as pd
import warnings

from . import plotting
from . import performance as perf
from . import utils
import os
import matplotlib
if os.environ.get('DISPLAY', '') == '':
print('no display found. Using non-interactive Agg backend')
matplotlib.use('Agg')
import matplotlib.gridspec as gridspec # noqa: E402
import matplotlib.pyplot as plt # noqa: E402
import pandas as pd # noqa: E402
import warnings # noqa: E402

from . import plotting # noqa: E402
from . import performance as perf # noqa: E402
from . import utils # noqa: E402


class GridFigure(object):
Expand Down

0 comments on commit 57c03b3

Please sign in to comment.