Suppress warning (and legend) if legend is required but no labels are

given.

Also start to implement a basic one-liner plot function, API still in
WIP.
This commit is contained in:
Lucas Verney 2016-03-01 15:34:11 +01:00
parent 81bb851e10
commit d67d185f86
2 changed files with 1592 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -129,5 +129,18 @@ class Figure():
# Create aliases for "upper" / "top" and "lower" / "bottom"
location.replace("top ", "upper ")
location.replace("bottom ", "lower ")
# Add legend
axes.legend(loc=location)
# Avoid warning if no labels were given for plots
nb_labelled_plots = sum(["label" in plt[1] for plt in self.plots])
if nb_labelled_plots > 0:
# Add legend
axes.legend(loc=location)
def plot(data, **kwargs):
"""
"""
figure = Figure(**kwargs)
# TODO: Fix API, support every plot type
for plt in data:
figure.plot(plt)
return figure