Plot each GO group.
508702
def plot_groups_unplaced(self, fout_dir=".", **kws_usr):
        """"""
        # kws: go2color max_gos upper_trigger max_upper
        plotobj = PltGroupedGos(self)
        return plotobj.plot_groups_unplaced(fout_dir, **kws_usr)
760669
def plot_data():
    '''

    '''

    var = ['temp', 'oxygen', 'salinity', 'fluorescence-ECO', 'density', 'PAR', 'turbidity', 'fluorescence-CDOM']
    # colorbar limits for each property
    lims = np.array([[26, 33], [0, 10], [0, 36], [0, 6], [1005, 1025], [0, 0.6], [0, 2], [0, 9]])  # reasonable values
    # lims = np.array([[20,36], [26,33], [1.5,5.6], [0,4], [0,9], [0,1.5]]) # values to show colormaps

    for fname in fnames:
        fig, axes = plt.subplots(nrows=4, ncols=2)
        fig.set_size_inches(20, 10)
        fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99, wspace=0.0, hspace=0.07)
        i = 0
        for ax, Var, cmap in zip(axes.flat, var, cmaps):  # loop through data to plot up

            # get variable data
            lat, lon, z, data = test.read(Var, fname)

            map1 = ax.scatter(lat, -z, c=data, cmap=cmap, s=10, linewidths=0., vmin=lims[i, 0], vmax=lims[i, 1])
            # no stupid offset
            y_formatter = mpl.ticker.ScalarFormatter(useOffset=False)
            ax.xaxis.set_major_formatter(y_formatter)
            if i == 6:
                ax.set_xlabel('Latitude [degrees]')
                ax.set_ylabel('Depth [m]')
            else:
                ax.set_xticklabels([])
                ax.set_yticklabels([])
            ax.set_ylim(-z.max(), 0)
            ax.set_xlim(lat.min(), lat.max())
            cb = plt.colorbar(map1, ax=ax, pad=0.02)
            cb.set_label(cmap.name + ' [' + '$' + cmap.units + '$]')
            i += 1

        fig.savefig('figures/' + fname.split('.')[0] + '.png', bbox_inches='tight')
1373785
def _plot(self):
        """"""
        r_max = min(
            self.view.x(1) - self.view.x(0),
            (self.view.y(0) or 0) - self.view.y(1)
        ) / (2 * 1.05)
        for serie in self.series:
            self.dot(serie, r_max)
692946
def get_goargs(self, go_args, prt):
        """"""
        goids = set()
        go2color = {}
        # Match on "GO ID" or "GO ID and color"
        re_gocolor = re.compile(r'(GO:\d{7})((?:#[0-9a-fA-F]{6})?)')
        for go_arg in go_args:
            mtch = re_gocolor.match(go_arg)
            if mtch:
                goid, color = mtch.groups()
                goids.add(goid)
                if color:
                    go2color[goid] = color
            elif go_arg in self.godagconsts.NS2GO:
                goids.add(self.godagconsts.NS2GO[go_arg])
            elif prt:
                prt.write("WARNING: UNRECOGNIZED ARG({})\n".format(go_arg))
        return goids
575256
def _get_gosubdagplotnts(self, hdrgo, usrgos, pltargs, go2parentids):
        """"""
        dotgraphs = []
        go2color = pltargs.get_go2color_inst(hdrgo)
        # namedtuple fields: hdrgo gosubdag tot_usrgos parentcnt desc
        ntpltgo0 = self._get_pltdag_ancesters(hdrgo, usrgos, desc="")
        ntpltgo1 = self._get_pltdag_path_hdr(hdrgo, usrgos, desc="pruned")
        num_go0 = len(ntpltgo0.gosubdag.go2obj)
        num_go1 = len(ntpltgo1.gosubdag.go2obj)
        title = "{GO} {NAME}; {N} GO sources".format(
            GO=hdrgo,
            NAME=self.gosubdag.go2obj[hdrgo].name,
            N=len(ntpltgo0.gosubdag.go_sources))
        # print("PltGroupedGos::_get_gosubdagplotnts TITLE", title)
        if num_go0 < pltargs.max_gos:
            # print("PltGroupedGos::_get_gosubdagplotnts ntpltgo0 ALWAYS IF NOT TOO BIG")
            dotgraphs.append(self._get_gosubdagplotnt(ntpltgo0, title, go2color, pltargs))
        # PLOT A: Plot the entire GO ID group under GO header, hdrgo, if not too big
        if num_go0 < pltargs.max_gos and \
            ntpltgo0.tot_usrgos == ntpltgo1.tot_usrgos:
            # print("PltGroupedGos::_get_gosubdagplotnts ntpltgo0 AAAAAAAAAAAAAAAAA")
            dotgraphs.append(self._get_gosubdagplotnt(ntpltgo0, title, go2color, pltargs))
        # PLOT B: Plot only the GO ID group passing thru the GO header, hdrgo, if not too big
        elif num_go1 < pltargs.max_gos and ntpltgo0.tot_usrgos != ntpltgo1.tot_usrgos:
            # print("PltGroupedGos::_get_gosubdagplotnts ntpltgo1(pruned) BBBBBBBBBBBBBBBBB")
            dotgraphs.append(self._get_gosubdagplotnt(ntpltgo1, title, go2color, pltargs))
        # PLOT C: If DAG is large, just print upper portion
        # PLOT D: If DAG is large, just print upper portion passing through the GO header
        elif num_go1 >= pltargs.upper_trigger:
            # print("PltGroupedGos::_get_gosubdagplotnts upper_pruned CCCCCCCCCCCCCCCCC")
            gos_upper = self._get_gos_upper(ntpltgo1, pltargs.max_upper, go2parentids)
            #ntpltgo2 = self._get_pltdag_ancesters(hdrgo, gos_upper, "{BASE}_upper.png")
            ntpltgo3 = self._get_pltdag_path_hdr(hdrgo, gos_upper, "upper_pruned")
            # Middle GO terms chosen to be start points will be green unless reset back
            for goid in gos_upper:
                if goid not in go2color:
                    go2color[goid] = 'white'
            dotgraphs.append(self._get_gosubdagplotnt(ntpltgo3, title, go2color, pltargs))
        else:
            # print("PltGroupedGos::_get_gosubdagplotnts EEEEEEEEEEEEEEEEE")
            self._no_ntplt(ntpltgo0)
        return dotgraphs
1335316
def plot_flat(r, c, figsize):
    ""
    return enumerate(plt.subplots(r, c, figsize=figsize)[1].flatten())
741005
def rectify_pgroups(self):
        
        # add any parameters groups
        pdata_groups = list(self.parameter_data.loc[:,"pargp"].\
            value_counts().keys())
        #print(pdata_groups)
        need_groups = []
        existing_groups = list(self.parameter_groups.pargpnme)
        for pg in pdata_groups:
            if pg not in existing_groups:
                need_groups.append(pg)
        if len(need_groups) > 0:
            #print(need_groups)
            defaults = copy.copy(pst_utils.pst_config["pargp_defaults"])
            for grp in need_groups:
                defaults["pargpnme"] = grp
                self.parameter_groups = \
                    self.parameter_groups.append(defaults,ignore_index=True)

        # now drop any left over groups that aren't needed
        for gp in self.parameter_groups.loc[:,"pargpnme"]:
            if gp in pdata_groups and gp not in need_groups:
                need_groups.append(gp)
        self.parameter_groups.index = self.parameter_groups.pargpnme
        self.parameter_groups = self.parameter_groups.loc[need_groups,:]
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
901275
def plot_cells(cell_1, cell_2, cell_3):
    """"""
    fig, ((ax1, ax2, ax3)) = plt.subplots(1, 3, figsize=(12, 5))
    for ax in [ax1, ax2, ax3]:
        ax.grid(False)
        ax.set_xticks([])
        ax.set_yticks([])
    ax1.set_title("Type 1")
    ax1.imshow(cell_1)
    ax2.set_title("Type 2")
    ax2.imshow(cell_2)
    ax3.set_title("Type 3")
    ax3.imshow(cell_3)
    return ax1, ax2, ax3
549835
def group_lines(lines):
    """"""
    groups = []
    group = []

    for line in lines:
        if line.strip() == "":
            groups.append(group[:])
            group = []
            continue
        group.append(line)

    if group:
        groups.append(group[:])

    return groups
1236232
def plot(data: Dict[str, np.array], fields: List[str] = None, *args, **kwargs):
    
    if plt is None:
        return

    if fields is None:
        fields = ['x', 'y', 'm', 'c']
    labels = []
    lines = []
    for field in fields:
        if min(data[field].shape) > 0:
            f_lines = plt.plot(data['t'], data[field], *args, **kwargs)
            lines.extend(f_lines)
            labels.extend(data['labels'][field])
    plt.legend(lines, labels, ncol=2, loc='best')
    plt.xlabel('t, sec')
    plt.grid()
969999
def map(self, fn):
        """"""
        return TimeSeries([(x, fn(y)) for x, y in self.points])
1011952
def plot_ts(fignum, dates, ts):
    
    vertical_plot_init(fignum, 10, 3)
    TS, Chrons = pmag.get_ts(ts)
    p = 1
    X, Y = [], []
    for d in TS:
        if d <= dates[1]:
            if d >= dates[0]:
                if len(X) == 0:
                    ind = TS.index(d)
                    X.append(TS[ind - 1])
                    Y.append(p % 2)
                X.append(d)
                Y.append(p % 2)
                p += 1
                X.append(d)
                Y.append(p % 2)
        else:
            X.append(dates[1])
            Y.append(p % 2)
            plt.plot(X, Y, 'k')
            plot_vs(fignum, dates, 'w', '-')
            plot_hs(fignum, [1.1, -.1], 'w', '-')
            plt.xlabel("Age (Ma): " + ts)
            isign = -1
            for c in Chrons:
                off = -.1
                isign = -1 * isign
                if isign > 0:
                    off = 1.05
                if c[1] >= X[0] and c[1] < X[-1]:
                    plt.text(c[1] - .2, off, c[0])
            return
25092
def plot_all(*args, **kwargs):
    '''
    
    '''
    dfs = do_all(*args, **kwargs)
    ps = []
    for line in dfs:
        f, df, config = line
        df.plot(title=config['name'])
        ps.append(df)
    return ps
1266916
def plot(self, **kwds):
        """
        plo = self.lx.plot(dist_to_center=3, **kwds)
        plo += self.ly.plot(dist_to_center=3, **kwds)
        plo += self.lz.plot(dist_to_center=3, **kwds)
        plo += self.lx_r.plot(dist_to_center=3, **kwds)
        plo += self.ly_r.plot(dist_to_center=3, **kwds)
        plo += self.lz_r.plot(dist_to_center=3, **kwds)
        return plo
561097
def plt_goids(gosubdag, fout_img, goids, **kws_plt):
    """"""
    gosubdag_plt = GoSubDag(goids, gosubdag.go2obj, rcntobj=gosubdag.rcntobj, **kws_plt)
    godagplot = GoSubDagPlot(gosubdag_plt, **kws_plt)
    godagplot.plt_dag(fout_img)
    return godagplot
62928
def prt_goids(self, goids=None, prtfmt=None, sortby=True, prt=sys.stdout):
        """"""
        if goids is None:
            goids = self.go_sources
        nts = self.get_nts(goids, sortby)
        if prtfmt is None:
            prtfmt = self.prt_attr['fmta']
        for ntgo in nts:
            key2val = ntgo._asdict()
            prt.write("{GO}\n".format(GO=prtfmt.format(**key2val)))
        return nts