diff --git a/CHANGES.rst b/CHANGES.rst index 034361b6..b3edcb8b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -25,6 +25,8 @@ Changelog - Change playground configuration to read O3 replay data from O2 replay data. +- Drop dependency on seaborn. + 0.12.3 (2020-03-24) ------------------- diff --git a/docs-requirements.txt b/docs-requirements.txt index 0b0df238..525e7db1 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -1,4 +1,3 @@ celery[redis]>=4.4.0 matplotlib -seaborn sphinx>=1.8.0b1 diff --git a/gwcelery/tasks/skymaps.py b/gwcelery/tasks/skymaps.py index cff00945..72ab9b3b 100644 --- a/gwcelery/tasks/skymaps.py +++ b/gwcelery/tasks/skymaps.py @@ -13,7 +13,6 @@ from ligo.skymap.tool import ligo_skymap_plot_volume from matplotlib import pyplot as plt import numpy as np -import seaborn from . import gracedb from . import lvalert @@ -187,7 +186,7 @@ def plot_bayes_factor(logb, plot_bayes_factor(6.3, title='GWCelery is awesome') """ - with seaborn.axes_style('ticks', seaborn.plotting_context('notebook')): + with plt.style.context('seaborn-notebook'): fig, ax = plt.subplots(figsize=(6, 1.7), tight_layout=True) ax.set_xlim(-xlim, xlim) ax.set_ylim(-0.5, 0.5) @@ -215,13 +214,19 @@ def plot_bayes_factor(logb, ax2.set_xticks(ticks) ax2.xaxis.set_major_formatter(fmt) levels = (-xlim, *ticks, xlim) - colors = seaborn.color_palette(palette, len(levels) - 1) - ax.barh(0, np.diff(levels), 1, levels[:-1], color=colors) + colors = plt.get_cmap(palette)(np.arange(1, len(levels)) / len(levels)) + ax.barh(0, np.diff(levels), 1, levels[:-1], + linewidth=plt.rcParams['xtick.major.width'], + color=colors, edgecolor='white') # Plot bar for log Bayes factor value - ax.barh(0, logb, 0.5, color='black') + ax.barh(0, logb, 0.5, color='black', + linewidth=plt.rcParams['xtick.major.width'], + edgecolor='white') - seaborn.despine(fig, ax, top=True, right=True, bottom=True, left=True) + for ax_ in fig.axes: + for spine in ax_.spines.values(): + spine.set_visible(False) return fig, ax diff --git a/requirements.txt b/requirements.txt index 99d322d8..db299c2c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,7 +27,6 @@ pygcn >= 1.0.1 pytest >= 3.0 python-ligo-lw safe-netrc -seaborn sentry-sdk[flask,tornado] service_identity # We don't actually use this package, but it silences some annoying warnings from twistd. sleek-lvalert < 2.0.0