Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saving scatter plots as svg #984

Merged
merged 1 commit into from
Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
-------------------

Expand Down
3 changes: 2 additions & 1 deletion glue/external/axescache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions glue/viewers/scatter/qt/tests/test_viewer_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down