parent
9689f4e45a
commit
94b3cb53c4
1598
Examples.ipynb
1598
Examples.ipynb
File diff suppressed because one or more lines are too long
@ -141,8 +141,28 @@ class Figure():
|
|||||||
def plot(data, **kwargs):
|
def plot(data, **kwargs):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
# Init new figure
|
||||||
figure = Figure(**kwargs)
|
figure = Figure(**kwargs)
|
||||||
# TODO: Fix API, support every plot type
|
# data is a list of graphs commands
|
||||||
for plt in data:
|
for graph in data:
|
||||||
figure.plot(plt)
|
# If we provide a tuple, handle it
|
||||||
|
if isinstance(graph, tuple):
|
||||||
|
args = ()
|
||||||
|
kwargs = {}
|
||||||
|
# First case, only two items provided
|
||||||
|
if len(graph) == 2:
|
||||||
|
# Parse args and kwargs according to type of items
|
||||||
|
if isinstance(graph[1], tuple):
|
||||||
|
args = (graph[1],)
|
||||||
|
elif isinstance(graph[1], dict):
|
||||||
|
kwargs = graph[1]
|
||||||
|
# Second case, at least 3 items provided
|
||||||
|
elif len(graph) > 2:
|
||||||
|
# Then, args and kwargs are well defined
|
||||||
|
args = (graph[1],)
|
||||||
|
kwargs = graph[2]
|
||||||
|
# Pass the correct argument to plot function
|
||||||
|
figure.plot(graph[0], *args, **kwargs)
|
||||||
|
else:
|
||||||
|
figure.plot(graph)
|
||||||
figure.show()
|
figure.show()
|
||||||
|
Loading…
Reference in New Issue
Block a user