Skip to content

Commit

Permalink
Add default image properties to scope
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Jul 1, 2020
1 parent bc09256 commit 8f069a3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion repos/kaleido/py/kaleido/scopes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ def __init__(self, disable_gpu=True):
# Collect chromium flags
self._disable_gpu = disable_gpu

# to_image-level default values
self.default_format = "png"
self.default_width = 700
self.default_height = 500
self.default_scale = 1

# Properties
self._std_error = io.StringIO()
self._std_error_thread = None
Expand Down Expand Up @@ -133,7 +139,14 @@ def disable_gpu(self, val):
self._disable_gpu = val
self._shutdown_kaleido()

def to_image(self, figure, format="png", width=700, height=500, scale=1):
def to_image(self, figure, format=None, width=None, height=None, scale=None):

# Infer defaults
format = format if format is not None else self.default_format
width = width if width is not None else self.default_width
height = height if height is not None else self.default_height
scale = scale if scale is not None else self.default_scale

# Ensure that kaleido subprocess is running
self._ensure_kaleido()

Expand Down

0 comments on commit 8f069a3

Please sign in to comment.