|
19 | 19 |
|
20 | 20 | import numpy as np |
21 | 21 | from matplotlib.figure import Figure |
| 22 | +from matplotlib.lines import Line2D |
22 | 23 |
|
23 | 24 | from atldld.constants import REF_DIM_25UM |
24 | 25 | from atldld.dataset import PlaneOfSection |
@@ -104,14 +105,32 @@ def dataset_preview( |
104 | 105 | # Y-label only on the left-most plot because it's the same for all plots |
105 | 106 | axs[0].set_ylabel(labels[y_axis], fontsize=16) |
106 | 107 |
|
| 108 | + # Add the legend for the reference space lines |
| 109 | + ref_space_line_style = {"color": "blue", "linestyle": ":"} |
| 110 | + line = Line2D([], [], **ref_space_line_style) |
| 111 | + axs[0].legend( |
| 112 | + [line], |
| 113 | + ["Reference space boundary"], |
| 114 | + loc="upper left", |
| 115 | + bbox_to_anchor=(0, -0.2), |
| 116 | + borderaxespad=0, |
| 117 | + frameon=False, |
| 118 | + ) |
| 119 | + |
107 | 120 | # The actual plotting |
108 | 121 | for ax, edge, x_axis, invert, title in zip(axs, edges, x_axes, inverts, titles): |
| 122 | + # Axes setup |
109 | 123 | ax.grid(True, linestyle=":", color="gray") |
110 | | - ax.set_ylim((0, ref_space_size[y_axis])) |
111 | 124 | ax.set_title(title) |
112 | 125 | ax.set_xlabel(labels[x_axis], fontsize=16) |
113 | | - ax.axvline(0, color="blue", linestyle=":") |
114 | | - ax.axvline(ref_space_size[x_axis], color="blue", linestyle=":") |
| 126 | + |
| 127 | + # Reference space boundary lines |
| 128 | + ax.axvline(0, **ref_space_line_style) |
| 129 | + ax.axvline(ref_space_size[x_axis], **ref_space_line_style) |
| 130 | + ax.axhline(0, **ref_space_line_style) |
| 131 | + ax.axhline(ref_space_size[y_axis], **ref_space_line_style) |
| 132 | + |
| 133 | + # Plot the section image edges |
115 | 134 | for corners in all_corners: |
116 | 135 | points = corners[np.ix_(edge, [x_axis, y_axis])] |
117 | 136 | coords = points.T / 25 |
|
0 commit comments