diff --git a/CHANGES.md b/CHANGES.md index 054dfa3c2..967c49058 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,8 @@ v0.8.2 (unreleased) * Fix a bug that caused ComponentIDComboHelper to not take into account the numeric and categorical options in __init__. [#1014] +* Fix a bug that caused saving of scatter plots to SVG files to crash. [#984] + v0.8.1 (2016-05-25) ------------------- diff --git a/glue/external/axescache.py b/glue/external/axescache.py index caa182b0b..b724ff22e 100644 --- a/glue/external/axescache.py +++ b/glue/external/axescache.py @@ -135,7 +135,8 @@ def __init__(self, axes): def draw(self, renderer, *args, **kwargs): if self._capture is None or not self._enabled: Axes.draw(self.axes, renderer, *args, **kwargs) - self._capture = RenderCapture(self.axes, renderer) + if hasattr(renderer, 'buffer_rgba'): + self._capture = RenderCapture(self.axes, renderer) else: self.axes.axesPatch.draw(renderer, *args, **kwargs) self._capture.draw(renderer, *args, **kwargs) diff --git a/glue/viewers/scatter/qt/tests/test_viewer_widget.py b/glue/viewers/scatter/qt/tests/test_viewer_widget.py index dd92323e7..a4eb27b46 100644 --- a/glue/viewers/scatter/qt/tests/test_viewer_widget.py +++ b/glue/viewers/scatter/qt/tests/test_viewer_widget.py @@ -320,6 +320,12 @@ def test_title_synced_if_data_removed(self): self.widget.remove_layer(l2) assert self.widget.windowTitle() == n1 + def test_save_svg(self, tmpdir): + # Regression test for a bug in AxesCache that caused SVG saving to + # fail (because renderer.buffer_rgba did not exist) + filename = tmpdir.join('test.svg').strpath + self.widget.client.axes.figure.savefig(filename) + class TestDrawCount(TestScatterWidget):