r"""Show created figures, alias to ``plt.show()``.

    By default, showing plots does not block the prompt.
    Calling this function will block execution.
355632
def show(*args, **kwargs):
    
    """
    _, plt, _ = _import_plt()
    plt.show(*args, **kwargs)
104144
def showDraw(self, fignum=1):
        
        if self._patches == []:
            print("Please setDraw() before showDraw(), then try again.")
            return
        else:
            fig = plt.figure(fignum)
            fig.clear()
            ax = fig.add_subplot(111, aspect='equal')
            [ax.add_patch(i) for i in self._patches]
            bbox = self._patches[0].get_path().get_extents()
            x0 = 2.0 * min(bbox.xmin, bbox.ymin)
            x1 = 2.0 * max(bbox.xmax, bbox.ymax)
            ax.set_xlim(x0, x1)
            ax.set_ylim(x0, x1)
            # x1,y1=tuple(self.nextp0)
            # x2,y2=tuple(self.nextp1)
            # x3,y3=tuple(self.nextpc)
            # ax.plot([x1,x2,x3], [y1,y2,y3], 'o')#, ms=5, fc='b', ec='b')
            x, y = tuple(self.next_p0)
            ax.plot(x, y, 'o', ms=10, c='b')

            ax.annotate(s=self._anote['name'],
                        xy=self._anote['xypos'],
                        xytext=self._anote['textpos'],
                        textcoords='data',
                        arrowprops=dict(arrowstyle='->'),
                        rotation=-90,
                        fontsize='small')

            fig.canvas.draw()
            plt.grid()
            plt.show()
1253110
def display_plots(filebase, directory=None, width=700, height=500, **kwargs):
    """"""
    def show_figure(filebase, directory, **kwargs):
        """Helper function to load in the relevant plot for display."""
        filename = filebase.format(**kwargs)
        if directory is not None:
            filename = directory + '/' + filename
        display(HTML("<img src='{filename}'>".format(filename=filename)))
        
    interact(show_figure, filebase=fixed(filebase), directory=fixed(directory), **kwargs)
1149364
def in_casapy (helper, caltable=None, selectcals={}, plotoptions={},
               xaxis=None, yaxis=None, figfile=None):
    
    if caltable is None:
        raise ValueError ('caltable')

    show_gui = (figfile is None)
    cp = helper.casans.cp

    helper.casans.tp.setgui (show_gui)
    cp.open (caltable)
    cp.selectcal (**selectcals)
    cp.plotoptions (**plotoptions)
    cp.plot (xaxis, yaxis)

    if show_gui:
        import pylab as pl
        pl.show ()
    else:
        cp.savefig (figfile)
946431
def wrplt(self, fout_dir, plt_ext="png"):
        """"""
        # Ex basename
        basename = self.grprobj.get_fout_base(self.ntplt.hdrgo)
        plt_pat = self.get_pltpat(plt_ext)
        fout_basename = plt_pat.format(BASE=basename)
        fout_plt = os.path.join(fout_dir, fout_basename)
        self.gosubdagplot.plt_dag(fout_plt) # Create Plot
        return fout_plt
110411
def do_show(self, args):
        
        args = args.strip()

        to_show = self._interp._root
        if args != "":
            try:
                to_show = self._interp.eval(args)
            except Exception as e:
                print("ERROR: " + e.message)
                return False

        if hasattr(to_show, "_pfp__show"):
            print(to_show._pfp__show())
        else:
            print(repr(to_show))
1322216
def draw_figs(FIGS):
    
    is_win = True if sys.platform in ['win32', 'win64'] else False
    if not is_win:
        plt.ion()
        for fig in list(FIGS.keys()):
            plt.draw()
            plt.show()
        plt.ioff()
    if is_win:
        # this style basically works for Windows
        plt.draw()
        print("You must manually close all plots to continue")
        plt.show()
891990
def show(self):
        """"""

        # noinspection PyPackageRequirements
        from IPython.display import Image, display

        fname = self.render()
        display(Image(filename=fname))
1213732
def plot_all(self, show=True, **kwargs):
        
        figs = []; app = figs.append
        app(self.plot_stacked_hist(show=show))
        app(self.plot_efficiency(show=show))
        app(self.plot_pie(show=show))
        return figs
548355
def show(self, imgs, ax=None):
        

        ax = ax or plt.gca()

        if type(imgs) is not list:
            imgs = [imgs]

        for i, img in enumerate(imgs):
            ax.imshow(img, cmap=plt.get_cmap("plasma"))
            ax.axis("off")
324874
def on_click_plot_widget(self, event):
        
        self.plot.source = self.sources
        self.plot.visible = event.new
        if self.plot.visible:
            self.plot.watchers.append(
                self.select.widget.link(self.plot, value='source'))
797017
def plot(self, figure_list):
        '''
        
        '''
        # if there is not image data get it from the current plot
        if not self.data == {} and self.data['image_data'] is  None:
            axes = figure_list[0].axes[0]
            if len(axes.images)>0:
                self.data['image_data'] = np.array(axes.images[0].get_array())
                self.data['extent'] = np.array(axes.images[0].get_extent())
                self.plot_settings['cmap'] = axes.images[0].get_cmap().name
                self.plot_settings['xlabel'] = axes.get_xlabel()
                self.plot_settings['ylabel'] = axes.get_ylabel()
                self.plot_settings['title'] = axes.get_title()
                self.plot_settings['interpol'] = axes.images[0].get_interpolation()

        Script.plot(self, figure_list)
1291956
def show_and_save_image(img, save_path):
  """"""
  try:
    import matplotlib.pyplot as plt  # pylint: disable=g-import-not-at-top
  except ImportError as e:
    tf.logging.warning(
        "Showing and saving an image requires matplotlib to be "
        "installed: %s", e)
    raise NotImplementedError("Image display and save not implemented.")
  plt.imshow(img)
  with tf.gfile.Open(save_path, "wb") as sp:
    plt.savefig(sp)
823319
def show_all(imgs:Collection[Image], r:int=1, c:Optional[int]=None, figsize=(12,6)):
    ""
    imgs = listify(imgs)
    if c is None: c = len(imgs)//r
    for i,ax in plot_flat(r,c,figsize): imgs[i].show(ax)
26853
def _finalise_figure(fig, **kwargs):  # pragma: no cover
    
    title = kwargs.get("title") or None
    show = kwargs.get("show") or False
    save = kwargs.get("save") or False
    savefile = kwargs.get("savefile") or "EQcorrscan_figure.png"
    return_fig = kwargs.get("return_figure") or False
    if title:
        fig.suptitle(title)
    if show:
        fig.show()
    if save:
        fig.savefig(savefile)
        print("Saved figure to {0}".format(savefile))
    if return_fig:
        return fig
    return None
1257709
def action_show(self):
        

        # helper function to display one row with colors
        # r = [name, path, command]
        def show_a_row(r):
            msg = colored('Shortcut: ', 'cyan') \
                + colored(r[0], 'white', attrs=['bold']) + '\n' \
                + self.shortcut_str(r[1], r[2]) + '\n'

            print(msg)

        name = self.args['<name>']

        if name is None or name == 'all':
            # select all shortcuts
            self.db_query('''
                SELECT name,path,command FROM shortcuts ORDER BY name
                ''')

            entries = self.db_fetch_all()

            # show the shortcuts
            if (entries is None) or (len(entries) == 0):
                print_err('No shortcuts defined.')
            else:
                for row in entries:
                    show_a_row(row)

        else:
            # select shortcut by name

            self.db_query('''
                SELECT name,path,command FROM shortcuts WHERE name=?
                ''', (name,))

            rec = self.db_fetch_one()

            # show the shortcut
            if rec is None:
                print_err('Shortcut "%s" does not exist.' % name)
            else:
                show_a_row(rec)
1268670
def _execute_show(self, show_command):
        
        rpc_command = '<CLI><Exec>{show_command}</Exec></CLI>'.format(
            show_command=escape_xml(show_command)
        )
        response = self._execute_rpc(rpc_command)
        raw_response = response.xpath('.//CLI/Exec')[0].text
        return raw_response.strip() if raw_response else ''