MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / __plot_grid

Method __plot_grid

Utility/Visualize/Matplotlib_Visualize.py:88–110  ·  view source on GitHub ↗
(dpi: int, n_rows: int, n_cols: int, plot_args: T.Sequence[T.Callable[[Axes], T.Any] | None], h_factor: float = 4, w_factor: float = 4)

Source from the content-addressed store, hash-verified

86
87 @staticmethod
88 def __plot_grid(dpi: int, n_rows: int, n_cols: int, plot_args: T.Sequence[T.Callable[[Axes], T.Any] | None], h_factor: float = 4, w_factor: float = 4) -> Figure:
89 fig = plt.figure(1, dpi=dpi, figsize=(n_rows * h_factor, n_cols * w_factor))
90
91 assert len(plot_args) <= n_rows * n_cols
92 axes = fig.subplots(n_rows, n_cols)
93 if isinstance(axes, np.ndarray): axes = axes.flatten()
94 else:
95 assert isinstance(axes, Axes)
96 axes = np.array([axes], dtype=object)
97 for ax, plot_arg in zip(axes, plot_args):
98 ax: Axes
99 if plot_arg is None:
100 ax.axis("off")
101 continue
102 plot_arg(ax)
103
104 for idx in range(len(plot_args), axes.size):
105 axes[idx].axis("off")
106
107 fig.set_figheight(n_rows * h_factor)
108 fig.set_figwidth(n_cols * w_factor)
109 fig.tight_layout()
110 return fig
111
112 @register
113 @staticmethod

Callers 4

plot_imatcherMethod · 0.80
plot_istereoMethod · 0.80
plot_macvoMethod · 0.80
plot_reprojerrMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected