assert isinstance(ax, matplotlib.axes.Axes) ax.set_aspect('equal') ax.set_xlim(0, images[0].pixel_data.shape[1]) ax.set_ylim(0, images[0].pixel_data.shape[0]) ax.add_artist(artist) inspector = InspectionTool() my_locals = dict([(k, v) for k, v in globals().items() if k.isupper()]) my_locals['images'] = images my_locals['objects'] = objects my_locals['masks'] = masks for fmt, sequence in (("i%d", images), ("o%d", objects), ("m%d", masks)): for i, v in enumerate(sequence): my_locals[fmt % (i+1)] = v my_locals['draw'] = matplotlib.pyplot.draw inspector.Init(locals = my_locals) inspector.Show() matplotlib.pyplot.draw() frame = matplotlib.pyplot.gcf().canvas.GetTopLevelParent() menu_bar = wx.MenuBar() menu = wx.Menu() sub_menu = wx.Menu() item = menu.AppendSubMenu(sub_menu, "Subplot") menu_bar.Append(menu, "Subplots") frame.SetMenuBar(menu_bar) artist.add_to_menu(frame, item) matplotlib.pyplot.show() finally: javabridge.kill_vm()
ax = figure.add_axes((0.05, 0.05, .9, .9)) assert isinstance(ax, matplotlib.axes.Axes) ax.set_aspect('equal') ax.set_xlim(0, images[0].pixel_data.shape[1]) ax.set_ylim(0, images[0].pixel_data.shape[0]) ax.add_artist(artist) inspector = InspectionTool() my_locals = dict([(k, v) for k, v in globals().items() if k.isupper()]) my_locals['images'] = images my_locals['objects'] = objects my_locals['masks'] = masks for fmt, sequence in (("i%d", images), ("o%d", objects), ("m%d", masks)): for i, v in enumerate(sequence): my_locals[fmt % (i + 1)] = v my_locals['draw'] = matplotlib.pyplot.draw inspector.Init(locals=my_locals) inspector.Show() matplotlib.pyplot.draw() frame = matplotlib.pyplot.gcf().canvas.GetTopLevelParent() menu_bar = wx.MenuBar() menu = wx.Menu() sub_menu = wx.Menu() item = menu.AppendSubMenu(sub_menu, "Subplot") menu_bar.Append(menu, "Subplots") frame.SetMenuBar(menu_bar) artist.add_to_menu(frame, item) matplotlib.pyplot.show() finally: javabridge.kill_vm()