Example #1
0
    def set_edgecolor(self, c):
        """
        Set the facecolor(s) of the collection. c can be a matplotlib color
        arg (all patches have same color), or a a sequence or rgba tuples; if
        it is a sequence the patches will cycle through the sequence

        ACCEPTS: matplotlib color arg or sequence of rgba tuples
        """
        self._edgecolors = colorConverter.to_rgba_list(c)
Example #2
0
    def __init__(
            self,
            edgecolors=None,
            facecolors=None,
            linewidths=None,
            antialiaseds=None,
            offsets=None,
            transOffset=identity_transform(),
            norm=None,  # optional for ScalarMappable
            cmap=None,  # ditto
    ):
        Collection.__init__(self)
        ScalarMappable.__init__(self, norm, cmap)

        if facecolors is None: facecolors = rcParams['patch.facecolor']
        if edgecolors is None: edgecolors = rcParams['patch.edgecolor']
        if linewidths is None: linewidths = (rcParams['patch.linewidth'], )
        if antialiaseds is None:
            antialiaseds = (rcParams['patch.antialiased'], )

        self._facecolors = colorConverter.to_rgba_list(facecolors)
        if edgecolors == 'None':
            self._edgecolors = self._facecolors
            linewidths = (0, )
        else:
            self._edgecolors = colorConverter.to_rgba_list(edgecolors)
        self._linewidths = linewidths
        self._antialiaseds = antialiaseds
        #self._offsets = offsets
        self._original_offsets = offsets
        self._cached_offsets = offsets
        self._transOffset = transOffset
        self._xunits = self._yunits = None
        self._update_cache = {
            '_original_offsets': None,
            '_xunits': None,
            '_yunits': None
        }
Example #3
0
    def __init__(
        self,
        segments,  # Can be None.
        linewidths=None,
        colors=None,
        antialiaseds=None,
        linestyle='solid',
        offsets=None,
        transOffset=None,  #identity_transform(),
        norm=None,
        cmap=None,
    ):
        """
        segments is a sequence of ( line0, line1, line2), where
        linen = (x0, y0), (x1, y1), ... (xm, ym), or the
        equivalent numerix array with two columns.
        Each line can be a different length.

        colors must be a tuple of RGBA tuples (eg arbitrary color
        strings, etc, not allowed).

        antialiaseds must be a sequence of ones or zeros

        linestyles is a string or dash tuple. Legal string values are
          solid|dashed|dashdot|dotted.  The dash tuple is (offset, onoffseq)
          where onoffseq is an even length tuple of on and off ink in points.

        If linewidths, colors, or antialiaseds is None, they default to
        their rc params setting, in sequence form.

        If offsets and transOffset are not None, then
        offsets are transformed by transOffset and applied after
        the segments have been transformed to display coordinates.

        If offsets is not None but transOffset is None, then the
        offsets are added to the segments before any transformation.
        In this case, a single offset can be specified as offsets=(xo,yo),
        and this value will be
        added cumulatively to each successive segment, so as
        to produce a set of successively offset curves.

        norm = None,  # optional for ScalarMappable
        cmap = None,  # ditto

        The use of ScalarMappable is optional.  If the ScalarMappable
        matrix _A is not None (ie a call to set_array has been made), at
        draw time a call to scalar mappable will be made to set the colors.
        """

        Collection.__init__(self)
        ScalarMappable.__init__(self, norm, cmap)

        if linewidths is None:
            linewidths = (rcParams['lines.linewidth'], )

        if colors is None:
            colors = (rcParams['lines.color'], )
        if antialiaseds is None:
            antialiaseds = (rcParams['lines.antialiased'], )

        self._colors = colorConverter.to_rgba_list(colors)
        self._aa = antialiaseds
        self._lw = linewidths
        self.set_linestyle(linestyle)
        self._uniform_offsets = None
        if offsets is not None:
            offsets = asarray(offsets)
            if len(offsets.shape) == 1:
                offsets = offsets[newaxis, :]  # Make it Nx2.
        if transOffset is None:
            if offsets is not None:
                self._uniform_offsets = offsets
                offsets = None
            transOffset = identity_transform()
        self._offsets = offsets
        self._transOffset = transOffset
        self.set_segments(segments)