Fixed bugs in visualization.show_BER_curves
This commit is contained in:
@@ -21,6 +21,7 @@ def _get_num_rows(num_graphs: int, num_cols: int) -> int:
|
||||
# TODO: Set proper line labels
|
||||
# TODO: Set proper axis titles
|
||||
# TODO: Should unnamed columns be dropped by this function or by the caller?
|
||||
# TODO: Handle number of graphs not nicely fitting into rows and columns
|
||||
def show_BER_curves(data: typing.List[pd.DataFrame], num_cols: int = 3) -> plt.figure:
|
||||
"""This function creates a matplotlib figure containing a number of BER curves.
|
||||
|
||||
@@ -30,9 +31,9 @@ def show_BER_curves(data: typing.List[pd.DataFrame], num_cols: int = 3) -> plt.f
|
||||
:return: Matplotlib figure
|
||||
"""
|
||||
num_graphs = len(data)
|
||||
num_rows = _get_num_rows(num_cols, num_cols)
|
||||
num_rows = _get_num_rows(num_graphs, num_cols)
|
||||
|
||||
fig, axes = plt.subplots(num_rows, num_cols)
|
||||
fig, axes = plt.subplots(num_rows, num_cols, squeeze=False)
|
||||
fig.suptitle("Bit-Error-Rates of various decoders for different codes")
|
||||
|
||||
axes = list(chain.from_iterable(axes))[:num_graphs] # Flatten the 2d axes array
|
||||
|
||||
Reference in New Issue
Block a user