MCPcopy Create free account
hub / github.com/plotly/plotly.py / merge_templates

Method merge_templates

plotly/io/_templates.py:189–223  ·  view source on GitHub ↗

Merge a collection of templates into a single combined template. Templates are process from left to right so if multiple templates specify the same propery, the right-most template will take precedence. Parameters ---------- args: list of Tem

(self, *args)

Source from the content-addressed store, hash-verified

187 return available
188
189 def merge_templates(self, *args):
190 """
191 Merge a collection of templates into a single combined template.
192 Templates are process from left to right so if multiple templates
193 specify the same propery, the right-most template will take
194 precedence.
195
196 Parameters
197 ----------
198 args: list of Template
199 Zero or more template objects (or dicts with compatible properties)
200
201 Returns
202 -------
203 template:
204 A combined template object
205
206 Examples
207 --------
208
209 >>> pio.templates.merge_templates(
210 ... go.layout.Template(layout={'font': {'size': 20}}),
211 ... go.layout.Template(data={'scatter': [{'mode': 'markers'}]}),
212 ... go.layout.Template(layout={'font': {'family': 'Courier'}}))
213 layout.Template({
214 'data': {'scatter': [{'mode': 'markers', 'type': 'scatter'}]},
215 'layout': {'font': {'family': 'Courier', 'size': 20}}
216 })
217 """
218 if args:
219 return reduce(self._merge_2_templates, args)
220 else:
221 from plotly.graph_objs.layout import Template
222
223 return Template()
224
225 def _merge_2_templates(self, template1, template2):
226 """

Callers 6

__getitem__Method · 0.95
validate_coerceMethod · 0.80
test_merge_0Method · 0.80
test_merge_1Method · 0.80
test_merge_2Method · 0.80
test_merge_3Method · 0.80

Calls 1

TemplateClass · 0.90

Tested by 4

test_merge_0Method · 0.64
test_merge_1Method · 0.64
test_merge_2Method · 0.64
test_merge_3Method · 0.64