Skip to content

Commit 1117833

Browse files
author
Martin Journois
committed
Move figsize argument form Figure._repr_html_ to Figure.__init__
1 parent ef07968 commit 1117833

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

folium/features.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,19 @@ def render(self, **kwargs):
120120
]
121121

122122
class Figure(Element):
123-
def __init__(self):
123+
def __init__(self, figsize=(17,10)):
124124
super(Figure, self).__init__()
125125
self._name = 'Figure'
126126
self.header = Element()
127127
self.html = Element()
128128
self.script = Element()
129-
#self.axes = []
130129

131130
self.header._parent = self
132131
self.html._parent = self
133132
self.script._parent = self
134133

134+
self.figsize = figsize
135+
135136
self._template = Template(u"""
136137
<!DOCTYPE html>
137138
<head>
@@ -191,7 +192,7 @@ def render(self, **kwargs):
191192
child.render(**kwargs)
192193
return self._template.render(this=self, kwargs=kwargs)
193194

194-
def _repr_html_(self, figsize=(17,10), **kwargs):
195+
def _repr_html_(self, **kwargs):
195196
"""Displays the Figure in a Jupyter notebook.
196197
197198
Parameters
@@ -207,7 +208,7 @@ def _repr_html_(self, figsize=(17,10), **kwargs):
207208
"""
208209
html = self.render(**kwargs)
209210

210-
width, height = figsize
211+
width, height = self.figsize
211212

212213
iframe = '<iframe src="{html}" width="{width}px" height="{height}px"></iframe>'\
213214
.format(\

0 commit comments

Comments
 (0)