def render(self, fig=None):
        import matplotlib.pyplot as plt
        if fig is None:
            fig = plt.gcf()
        # Look for the last TrellisGrid instance in the layer list
        last_trellis = None
        for layer in self.layers:
            if isinstance(layer, TrellisGrid):
                last_trellis = layer
        if last_trellis is None:
            # We have a simple, non-trellised plot
            new_layers = sequence_layers(self.layers)
            for layer in new_layers:
                layer.work(fig=fig)
            legend = {}
            for layer in new_layers:
                legend = dictionary_union(legend, layer.legend)
            patches = []
            labels = []
            if len(list(legend.keys())) == 0:
                key_function = lambda tup: tup
            elif len(list(legend.keys())[0]) == 2:
                key_function = lambda tup: (tup[1])
            else:
                key_function = lambda tup: (tup[1], tup[3])
            for key in sorted(list(legend.keys()), key=key_function):
                value = legend[key]
                patches.append(value)
                if len(key) == 2:
                    col, val = key
                    labels.append("%s" % str(val))
                elif len(key) == 4:
                    col1, val1, col2, val2 = key
                    labels.append("%s, %s" % (str(val1), str(val2)))
                else:
                    raise ValueError("Maximum 2 categorical attributes to "
                                     "display a lengend of")
            if len(legend):
                fig.legend(patches, labels, loc='upper right')
        else:
            # We have a trellised plot.  First let's remove all other
            # TrellisGrid instances from the layer list, including this one.
            new_layers = []
            for layer in self.layers:
                if not isinstance(layer, TrellisGrid):
                    new_layers.append(layer)
            new_layers = sequence_layers(new_layers)
            # Now replace the old layers by their trellised versions
            new_layers = last_trellis.trellis(new_layers)
            # Prepare the subplots and draw on them
            new_layers = sequence_grids(new_layers)
            axes_grids = [work_grid(grid, fig) for grid in new_layers]
            axes_grid = axes_grids[-1]
            adjust_subplots(fig, axes_grid, last_trellis, new_layers[-1])
        # And we're done
        return fig
Get a list of network devices.
dataset/ETHPy150Open pydata/pandas/pandas/tools/rplot.py/RPlot.render--crossover with--dataset/ETHPy150Open openlmi/openlmi-scripts/commands/networking/lmi/scripts/networking/__init__.py/list_devices