Skip to content

Commit

Permalink
Drop dependency on seaborn
Browse files Browse the repository at this point in the history
We are only using Seaborn for configuring styles, and Matplotlib
now ships with Seaborn stylesheets.
lpsinger committed May 4, 2020
1 parent 3be4adb commit ffc0c12
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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)
-------------------

1 change: 0 additions & 1 deletion docs-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
celery[redis]>=4.4.0
matplotlib
seaborn
sphinx>=1.8.0b1
17 changes: 11 additions & 6 deletions gwcelery/tasks/skymaps.py
Original file line number Diff line number Diff line change
@@ -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

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ffc0c12

Please sign in to comment.