Skip to content

Commit c99a7b8

Browse files
author
Dominik R Laetsch
committed
Fix for older MPLs
AxisBG vs Facecolour
1 parent 0a3f933 commit c99a7b8

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

bloblib/BtPlot.py

+15-4
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,20 @@ def setupPlot(self, plot):
422422
rect_scatter, rect_histx, rect_histy, rect_legend = set_canvas()
423423
# Setting up plots and axes
424424
fig = plt.figure(1, figsize=(35,35), dpi=400)
425-
axScatter = plt.axes(rect_scatter, facecolor=BGGREY)
425+
try:
426+
axScatter = plt.axes(rect_scatter, facecolor=BGGREY)
427+
except AttributeError:
428+
axScatter = plt.axes(rect_scatter, axisbg=BGGREY)
426429
axScatter = set_format_scatterplot(axScatter, min_cov=self.min_cov, max_cov=self.max_cov, plot=plot)
427430
axScatter.set_xlabel(self.xlabel)
428431
axScatter.set_ylabel(self.ylabel)
429-
axHistx = plt.axes(rect_histx, facecolor=BGGREY)
432+
try:
433+
axHistx = plt.axes(rect_histx, facecolor=BGGREY)
434+
axHisty = plt.axes(rect_histy, facecolor=BGGREY)
435+
except AttributeError:
436+
axHistx = plt.axes(rect_histx, axisbg=BGGREY)
437+
axHisty = plt.axes(rect_histy, axisbg=BGGREY)
430438
axHistx = set_format_hist_x(axHistx, axScatter)
431-
axHisty = plt.axes(rect_histy, facecolor=BGGREY)
432439
axHisty = set_format_hist_y(axHisty, axScatter)
433440
if self.hist_type == "span":
434441
axHistx.set_ylabel("Span (kb)")
@@ -438,7 +445,11 @@ def setupPlot(self, plot):
438445
axHisty.set_xlabel("Count", rotation='horizontal')
439446
for xtick in axHisty.get_xticklabels(): # rotate text for ticks in cov histogram
440447
xtick.set_rotation(270)
441-
axLegend = plt.axes(rect_legend, facecolor=WHITE)
448+
449+
try:
450+
axLegend = plt.axes(rect_legend, facecolor=WHITE)
451+
except AttributeError:
452+
axLegend = plt.axes(rect_legend, axisbg=WHITE)
442453
axLegend.xaxis.set_major_locator(plt.NullLocator())
443454
axLegend.xaxis.set_major_formatter(nullfmt)
444455
axLegend.yaxis.set_major_locator(plt.NullLocator())

0 commit comments

Comments
 (0)