Allow set_grid with a single string if there is a single row description

This commit is contained in:
Lucas Verney 2016-03-04 11:58:08 +01:00
parent e417a41c6b
commit 30edf021b6
2 changed files with 797 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -128,7 +128,8 @@ class Figure():
``replot.Figure.plot``).
:param grid_description: A list of rows. Each row is a string \
containing the groups to display (can be seen as ASCII art).
containing the groups to display (can be seen as ASCII art). \
Can be a single string in case of a single row.
:param auto: Whether the grid should be guessed automatically from \
groups or not (optional). Can be a boolean or a dict having \
the possible ``height`` (int), ``width`` (int) and \
@ -161,6 +162,9 @@ class Figure():
# Disable the grid and return
self.grid = False
return
elif isinstance(grid_description, str):
# If a single string is provided, enclose it in a list.
grid_description = [grid_description]
# Check that grid is not empty
if len(grid_description) == 0: