Fixed graph spacing; Now calculating figsize depending on the number of row and columns
This commit is contained in:
parent
d9009970ad
commit
c09e20cce4
@ -6,7 +6,6 @@ import os
|
||||
from utility import visualization
|
||||
|
||||
|
||||
# TODO: Fix spacing between axes and margins
|
||||
def plot_results():
|
||||
graph_names = {"96.3.965": "n=96, k=48 - 965",
|
||||
"204.3.486": "n=204, k=102 - 486",
|
||||
|
||||
@ -17,7 +17,6 @@ def _get_num_rows(num_graphs: int, num_cols: int) -> int:
|
||||
return math.ceil(num_graphs / num_cols)
|
||||
|
||||
|
||||
# TODO: Calculate fig size in relation to the number of rows and columns
|
||||
# TODO: Handle number of graphs not nicely fitting into rows and columns
|
||||
def show_BER_curves(title: str,
|
||||
data: typing.Dict[str, pd.DataFrame],
|
||||
@ -36,9 +35,16 @@ def show_BER_curves(title: str,
|
||||
num_graphs = len(data)
|
||||
num_rows = _get_num_rows(num_graphs, num_cols)
|
||||
|
||||
fig, axes = plt.subplots(num_rows, num_cols, squeeze=False)
|
||||
fig, axes = plt.subplots(num_rows, num_cols, figsize=(num_cols*4, num_rows*4), squeeze=False)
|
||||
fig.suptitle(title)
|
||||
|
||||
fig.subplots_adjust(left=0.1,
|
||||
bottom=0.1,
|
||||
right=0.9,
|
||||
top=0.9,
|
||||
wspace=0.3,
|
||||
hspace=0.4)
|
||||
|
||||
axes = list(chain.from_iterable(axes))[:num_graphs] # Flatten the 2d axes array
|
||||
|
||||
for axis, name_data_pair in zip(axes, sorted(data.items())):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user