@@ -166,9 +166,13 @@ def _get_image(i):
166
166
167
167
self ._image_index = 0
168
168
if self ._multi :
169
- self ._image_ax , self ._button_ax = self ._fig .subplots (1 , 2 )
169
+ self ._image_ax , self ._info_ax = self ._fig .subplots (1 , 2 )
170
170
else :
171
- self ._image_ax = self ._fig .add_subplot (111 )
171
+ gs = self ._fig .add_gridspec (1 , 5 )
172
+ self ._image_ax = self ._fig .add_subplot (gs [:, :- 1 ])
173
+ self ._info_ax = self ._fig .add_subplot (gs [:, - 1 ])
174
+
175
+ self ._info_ax .axis ("off" )
172
176
aspect = imshow_kwargs .pop ("aspect" , "equal" )
173
177
self ._im = self ._image_ax .imshow (
174
178
self ._get_image (0 ), aspect = aspect , ** imshow_kwargs
@@ -183,14 +187,14 @@ def on_state_change(new_state, old_state):
183
187
texts = []
184
188
for key , klass in zip (self ._label_keymap .keys (), classes ):
185
189
texts .append (f"[{ key } ]\n { str (klass )} " )
186
- self ._buttons = button_array (texts , self ._button_ax )
190
+ self ._buttons = button_array (texts , self ._info_ax )
187
191
self ._buttons .on_state_change (on_state_change )
188
192
else :
189
193
# shift axis to make room for list of keybindings
190
- box = self ._image_ax .get_position ()
191
- box .x0 = box .x0 - 0.20
192
- box .x1 = box .x1 - 0.20
193
- self ._image_ax .set_position (box )
194
+ # box = self._image_ax.get_position()
195
+ # box.x0 = box.x0 - 0.20
196
+ # box.x1 = box.x1 - 0.20
197
+ # self._image_ax.set_position(box)
194
198
195
199
# these are matplotlib.patch.Patch properties
196
200
props = dict (boxstyle = "round" , facecolor = "wheat" , alpha = 0.5 )
@@ -200,11 +204,11 @@ def on_state_change(new_state, old_state):
200
204
-> : Next Image"""
201
205
horiz_pos = 0.575
202
206
203
- self ._image_ax .text (
207
+ self ._info_ax .text (
204
208
horiz_pos ,
205
209
0.75 ,
206
210
textstr ,
207
- transform = self ._fig .transFigure ,
211
+ # transform=self._fig.transFigure,
208
212
fontsize = 14 ,
209
213
verticalalignment = "top" ,
210
214
bbox = props ,
@@ -215,22 +219,22 @@ def on_state_change(new_state, old_state):
215
219
for k , v in self ._label_keymap .items ():
216
220
textstr += f"{ k } : { self ._classes [v ]} \n "
217
221
218
- self ._image_ax .text (
222
+ self ._info_ax .text (
219
223
horiz_pos ,
220
224
0.55 ,
221
225
textstr ,
222
- transform = self ._fig .transFigure ,
226
+ # transform=self._fig.transFigure,
223
227
fontsize = 14 ,
224
228
verticalalignment = "top" ,
225
229
bbox = props ,
226
230
)
227
231
228
232
textstr = f"Current Class:\n { str (self ._labels [0 ])} "
229
- self ._class_display = self ._image_ax .text (
233
+ self ._class_display = self ._info_ax .text (
230
234
horiz_pos ,
231
235
0.25 ,
232
236
textstr ,
233
- transform = self ._fig .transFigure ,
237
+ # transform=self._fig.transFigure,
234
238
fontsize = 14 ,
235
239
verticalalignment = "top" ,
236
240
bbox = props ,
0 commit comments