Skip to content

Commit 143d267

Browse files
author
Stanislav Schmidt
committed
Remove ylim, add full reference space boundary
1 parent 5d3b5ab commit 143d267

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/atldld/plot.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import numpy as np
2121
from matplotlib.figure import Figure
22+
from matplotlib.lines import Line2D
2223

2324
from atldld.constants import REF_DIM_25UM
2425
from atldld.dataset import PlaneOfSection
@@ -104,14 +105,32 @@ def dataset_preview(
104105
# Y-label only on the left-most plot because it's the same for all plots
105106
axs[0].set_ylabel(labels[y_axis], fontsize=16)
106107

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+
107120
# The actual plotting
108121
for ax, edge, x_axis, invert, title in zip(axs, edges, x_axes, inverts, titles):
122+
# Axes setup
109123
ax.grid(True, linestyle=":", color="gray")
110-
ax.set_ylim((0, ref_space_size[y_axis]))
111124
ax.set_title(title)
112125
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
115134
for corners in all_corners:
116135
points = corners[np.ix_(edge, [x_axis, y_axis])]
117136
coords = points.T / 25

0 commit comments

Comments
 (0)