Skip to content

Commit 34cc7df

Browse files
committed
Added add_imshow
1 parent daca452 commit 34cc7df

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/maxplotlib/subfigure/line_plot.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ def add_line(self, x_data, y_data, layer=0, plot_type='plot', **kwargs):
9191
self.layered_line_data[layer].append(ld)
9292
else:
9393
self.layered_line_data[layer] = [ld]
94+
95+
def add_imshow(self, data, layer=0, plot_type='imshow', **kwargs):
96+
ld = {
97+
"data": np.array(data),
98+
"layer": layer,
99+
"plot_type": plot_type,
100+
"kwargs": kwargs,
101+
}
102+
self.line_data.append(ld)
103+
if layer in self.layered_line_data:
104+
self.layered_line_data[layer].append(ld)
105+
else:
106+
self.layered_line_data[layer] = [ld]
94107

95108
@property
96109
def layers(self):
@@ -122,6 +135,11 @@ def plot_matplotlib(self, ax, layers=None):
122135
(line["y"] + self._yshift) * self._yscale,
123136
**line["kwargs"],
124137
)
138+
elif line["plot_type"] == "imshow":
139+
ax.imshow(
140+
line["data"],
141+
**line["kwargs"],
142+
)
125143
# if self._caption:
126144
# ax.set_title(self._caption)
127145
if self._title:

0 commit comments

Comments
 (0)