(self, target=None, bbox=None, palette=None, background=None)
Creates a new plot.

        @param target: the target surface to write to. It can be one of the
          following types:

            - C{None} -- an appropriate surface will be created and the object
              will be plotted there.

            - C{cairo.Surface} -- the given Cairo surface will be used.

            - C{string} -- a file with the given name will be created and an
              appropriate Cairo surface will be attached to it.

        @param bbox: the bounding box of the surface. It is interpreted
          differently with different surfaces: PDF and PS surfaces will
          treat it as points (1 point = 1/72 inch). Image surfaces will
          treat it as pixels. SVG surfaces will treat it as an abstract
          unit, but it will mostly be interpreted as pixels when viewing
          the SVG file in Firefox.

        @param palette: the palette primarily used on the plot if the
          added objects do not specify a private palette. Must be either
          an L{igraph.drawing.colors.Palette} object or a string referring
          to a valid key of C{igraph.drawing.colors.palettes} (see module
          L{igraph.drawing.colors}) or C{None}. In the latter case, the default
          palette given by the configuration key C{plotting.palette} is used.

        @param background: the background color. If C{None}, the background
          will be transparent. You can use any color specification here that
          is understood by L{igraph.drawing.colors.color_name_to_rgba}.
Creates a new plot.
Creates a new plot .
def __init__(self, target=None, bbox=None, palette=None, background=None):
        """Creates a new plot.

        @param target: the target surface to write to. It can be one of the
          following types:

            - C{None} -- an appropriate surface will be created and the object
              will be plotted there.

            - C{cairo.Surface} -- the given Cairo surface will be used.

            - C{string} -- a file with the given name will be created and an
              appropriate Cairo surface will be attached to it.

        @param bbox: the bounding box of the surface. It is interpreted
          differently with different surfaces: PDF and PS surfaces will
          treat it as points (1 point = 1/72 inch). Image surfaces will
          treat it as pixels. SVG surfaces will treat it as an abstract
          unit, but it will mostly be interpreted as pixels when viewing
          the SVG file in Firefox.

        @param palette: the palette primarily used on the plot if the
          added objects do not specify a private palette. Must be either
          an L{igraph.drawing.colors.Palette} object or a string referring
          to a valid key of C{igraph.drawing.colors.palettes} (see module
          L{igraph.drawing.colors}) or C{None}. In the latter case, the default
          palette given by the configuration key C{plotting.palette} is used.

        @param background: the background color. If C{None}, the background
          will be transparent. You can use any color specification here that
          is understood by L{igraph.drawing.colors.color_name_to_rgba}.
        """
        self._filename = None
        self._surface_was_created = not isinstance(target, cairo.Surface)
        self._need_tmpfile = False

        # Several Windows-specific hacks will be used from now on, thanks
        # to Dale Hunscher for debugging and fixing all that stuff
        self._windows_hacks = "Windows" in platform.platform()

        if bbox is None:
            self.bbox = BoundingBox(600, 600)
        elif isinstance(bbox, tuple) or isinstance(bbox, list):
            self.bbox = BoundingBox(bbox)
        else:
            self.bbox = bbox

        if palette is None:
            config = Configuration.instance()
            palette = config["plotting.palette"]
        if not isinstance(palette, Palette):
            palette = palettes[palette]
        self._palette = palette

        if target is None:
            self._need_tmpfile = True
            self._surface = cairo.ImageSurface(
                cairo.FORMAT_ARGB32, int(self.bbox.width), int(self.bbox.height)
            )
        elif isinstance(target, cairo.Surface):
            self._surface = target
        else:
            self._filename = target
            _, ext = os.path.splitext(target)
            ext = ext.lower()
            if ext == ".pdf":
                self._surface = cairo.PDFSurface(
                    target, self.bbox.width, self.bbox.height
                )
            elif ext == ".ps" or ext == ".eps":
                self._surface = cairo.PSSurface(
                    target, self.bbox.width, self.bbox.height
                )
            elif ext == ".png":
                self._surface = cairo.ImageSurface(
                    cairo.FORMAT_ARGB32, int(self.bbox.width), int(self.bbox.height)
                )
            elif ext == ".svg":
                self._surface = cairo.SVGSurface(
                    target, self.bbox.width, self.bbox.height
                )
            else:
                raise ValueError("image format not handled by Cairo: %s" % ext)

        self._ctx = cairo.Context(self._surface)
        self._objects = []
        self._is_dirty = False

        self.background = background
def __init__ ( self , target = None , bbox = None , palette = None , background = None ) : self . _filename = None self . _surface_was_created = not isinstance ( target , cairo . Surface ) self . _need_tmpfile = False # Several Windows-specific hacks will be used from now on, thanks # to Dale Hunscher for debugging and fixing all that stuff self . _windows_hacks = "Windows" in platform . platform ( ) if bbox is None : self . bbox = BoundingBox ( 600 , 600 ) elif isinstance ( bbox , tuple ) or isinstance ( bbox , list ) : self . bbox = BoundingBox ( bbox ) else : self . bbox = bbox if palette is None : config = Configuration . instance ( ) palette = config [ "plotting.palette" ] if not isinstance ( palette , Palette ) : palette = palettes [ palette ] self . _palette = palette if target is None : self . _need_tmpfile = True self . _surface = cairo . ImageSurface ( cairo . FORMAT_ARGB32 , int ( self . bbox . width ) , int ( self . bbox . height ) ) elif isinstance ( target , cairo . Surface ) : self . _surface = target else : self . _filename = target _ , ext = os . path . splitext ( target ) ext = ext . lower ( ) if ext == ".pdf" : self . _surface = cairo . PDFSurface ( target , self . bbox . width , self . bbox . height ) elif ext == ".ps" or ext == ".eps" : self . _surface = cairo . PSSurface ( target , self . bbox . width , self . bbox . height ) elif ext == ".png" : self . _surface = cairo . ImageSurface ( cairo . FORMAT_ARGB32 , int ( self . bbox . width ) , int ( self . bbox . height ) ) elif ext == ".svg" : self . _surface = cairo . SVGSurface ( target , self . bbox . width , self . bbox . height ) else : raise ValueError ( "image format not handled by Cairo: %s" % ext ) self . _ctx = cairo . Context ( self . _surface ) self . _objects = [ ] self . _is_dirty = False self . background = background