Loading plot_broken_edges.py +17 −7 Original line number Diff line number Diff line Loading @@ -63,23 +63,33 @@ def flatten_dict(dict_to_flatten : dict[int, list[list[int]]]) -> dict[int, list new_dict[key] = flat_list return new_dict def set_matplotlib_dims(data_list, width = 3): nx = len(data_list) depth = math.ceil(nx / 3) return nx, width, depth def get_index(i, graph_num, width): if graph_num <= width: index = i else: index = i//width, i%width return index def plot_distribution_of_height(edges_coordinates_dict : dict[int, list[list[int, int, int, int, int, int]]]): nx = len(edges_coordinates_dict) width = 3 depth = math.ceil(nx / 3) graph_num, width, depth = set_matplotlib_dims(edges_coordinates_dict) fig, axs = plt.subplots(depth,width) fig.tight_layout(pad=1.0) edges_coordinates_dict_flat = flatten_dict(edges_coordinates_dict) for i, (offset, edges_coordinates) in enumerate(edges_coordinates_dict_flat.items()): index = get_index(i, graph_num, width) z_list = [ min(edge[2], edge[5]) for edge in edges_coordinates] z_min = min(z_list) z_max = max(z_list) z_range = z_max - z_min axs[i//width, i%width].set_title(f"Offset {offset}") axs[i//width, i%width].hist(z_list, bins=z_range+1) axs[i//width, i%width].set_xlabel("z position") axs[i//width, i%width].set_ylabel("Broken edges") axs[index].set_title(f"Offset {offset}") axs[index].hist(z_list, bins=z_range+1) axs[index].set_xlabel("z position") axs[index].set_ylabel("Broken edges") plt.show() def plot_edges(edges_coordinates : [int, int, int, int, int, int] ): Loading Loading
plot_broken_edges.py +17 −7 Original line number Diff line number Diff line Loading @@ -63,23 +63,33 @@ def flatten_dict(dict_to_flatten : dict[int, list[list[int]]]) -> dict[int, list new_dict[key] = flat_list return new_dict def set_matplotlib_dims(data_list, width = 3): nx = len(data_list) depth = math.ceil(nx / 3) return nx, width, depth def get_index(i, graph_num, width): if graph_num <= width: index = i else: index = i//width, i%width return index def plot_distribution_of_height(edges_coordinates_dict : dict[int, list[list[int, int, int, int, int, int]]]): nx = len(edges_coordinates_dict) width = 3 depth = math.ceil(nx / 3) graph_num, width, depth = set_matplotlib_dims(edges_coordinates_dict) fig, axs = plt.subplots(depth,width) fig.tight_layout(pad=1.0) edges_coordinates_dict_flat = flatten_dict(edges_coordinates_dict) for i, (offset, edges_coordinates) in enumerate(edges_coordinates_dict_flat.items()): index = get_index(i, graph_num, width) z_list = [ min(edge[2], edge[5]) for edge in edges_coordinates] z_min = min(z_list) z_max = max(z_list) z_range = z_max - z_min axs[i//width, i%width].set_title(f"Offset {offset}") axs[i//width, i%width].hist(z_list, bins=z_range+1) axs[i//width, i%width].set_xlabel("z position") axs[i//width, i%width].set_ylabel("Broken edges") axs[index].set_title(f"Offset {offset}") axs[index].hist(z_list, bins=z_range+1) axs[index].set_xlabel("z position") axs[index].set_ylabel("Broken edges") plt.show() def plot_edges(edges_coordinates : [int, int, int, int, int, int] ): Loading