Skip to content

Commit

Permalink
Merge pull request #7 from alcarney/develop
Browse files Browse the repository at this point in the history
New Release v0.4.2
  • Loading branch information
alcarney authored Sep 17, 2018
2 parents f3a2f89 + b0ab4db commit 1a37948
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
v0.4.2 - 2018-09-17
-------------------

Added
^^^^^

- :code:`Image` objects can now take a :code:`size` keyword argument to adjust
the size of the matplotlib preview plots


v0.4.1 - 2018-09-17
-------------------

Expand Down
2 changes: 1 addition & 1 deletion stylo/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.1"
__version__ = "0.4.2"
10 changes: 8 additions & 2 deletions stylo/image/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@


class Image(ABC):
def __call__(self, width, height, filename=None):
def __call__(self, width, height, filename=None, size=None):

image = self._render(width, height)

if filename is not None:
self._save(image, filename)
return

return plt.imshow(image)
if size is None:
size = (4, 4)

fig, ax = plt.subplots(1, figsize=size)
ax.imshow(image)

return fig

def _save(self, image, filename):

Expand Down

0 comments on commit 1a37948

Please sign in to comment.