Beispiel #1
0
    def plotCells(self, engine='mpl', ax=None,
                  usemask=True, cell_kws=None,
                  domain_kws=None, extent_kws=None,
                  showisland=True, island_kws=None):
        """
        Creates a figure of the cells, boundary, domain, and islands.

        Parameters
        ----------
        engine : str
            The plotting engine to be used. Right now, only `'mpl'` has
            been implemented. Interactive figures via `'bokeh'` are
            planned.
        ax : matplotlib.Axes, optional
            The axes onto which the data will be drawn. If not provided,
            a new one will be created. Applies only to the *mpl* engine.
        usemask : bool, optional
            Whether or not cells should have the ModelGrid's mask
            applied to them.
        cell_kws, domain_kws, extent_kws, island_kws : dict
            Dictionaries of plotting options for each element
            of the figure.

            .. note:
            ``cell_kws`` and ``island_kws`` are feed to
            :func:`~matplotlib.pyplot.Polygon`. All others are sent
            to :meth:`~ax.plot`.

        """

        if cell_kws is None:
            cell_kws = {}
        fig = viz.plotCells(self.xn, self.yn, engine=engine, ax=ax,
                            mask=self.cell_mask, **cell_kws)

        if domain_kws is not None:
            fig = viz.plotDomain(data=self.domain, engine=engine, ax=ax, **domain_kws)

        if extent_kws:
            fig = viz.plotBoundaries(extent=self.extent, engine=engine, ax=ax, **extent_kws)

        if island_kws:
            fig = viz.plotBoundaries(islands=self.islands, engine=engine, ax=ax, **island_kws)

        return fig
Beispiel #2
0
 def test_plotCells_smoke(self):
     x, y = pgtest.makeSimpleNodes()
     fig1 = viz.plotCells(x, y)