MCPcopy Create free account
hub / github.com/MarcCoru/locationencoder / plot_result_matrix

Function plot_result_matrix

utils/plot_results.py:226–249  ·  view source on GitHub ↗
(resultsdir, positional_encoders, neural_networks, show=False, savepath=None)

Source from the content-addressed store, hash-verified

224
225
226def plot_result_matrix(resultsdir, positional_encoders, neural_networks, show=False, savepath=None):
227 fig, axs_arr = plt.subplots(len(positional_encoders), len(neural_networks), figsize=(16*len(neural_networks), 10*len(positional_encoders)))
228
229 if len(positional_encoders) == 1:
230 axs_arr = [axs_arr]
231 if len(neural_networks) == 1:
232 axs_arr = [axs_arr]
233
234 for pe, ax_row in zip(positional_encoders, axs_arr):
235 for nn, ax in zip(neural_networks, ax_row):
236 filename = find_matrix_plot_filename(resultsdir, pe, nn)
237
238 image = plt.imread(os.path.join(resultsdir,filename))
239 ax.imshow(image)
240 ax.axis("off")
241
242 plt.tight_layout()
243
244 if show:
245 plt.show()
246
247 if savepath is not None:
248 os.makedirs(os.path.dirname(savepath), exist_ok=True)
249 plt.savefig(savepath, bbox_inches="tight", pad_inches=0, transparent=True)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected