示例#1
0
    def draw_path_collection(self, **props):
        """Open path_collection to support 3d Objects from matplotlib figure"""
        if props['offset_coordinates'] == 'data':
            markerstyle = mpltools.get_markerstyle_from_collection(props)
            scatter_props = {
                'coordinates': 'data',
                'data': props['offsets'],
                'label': None,
                'markerstyle': markerstyle,
                'linestyle': None,
            }
            if isinstance(props['mplobj'],
                          Path3DCollection):  # Support for scatter3d plots
                scatter_props['data'] = self.get_3d_array(
                    props['mplobj']._offsets3d)
                self.draw_3d_collection(**scatter_props)

            else:
                self.msg += '    Drawing path collection as markers\n'
                self.draw_marked_line(**scatter_props)
        else:
            self.msg += '    Path collection not linked to "data", ' 'not drawing\n'
            warnings.warn('Dang! That path collection is out of this '
                          'world. I totally don\'t know what to do with '
                          'it yet! Plotly can only import path '
                          'collections linked to "data" coordinates')
示例#2
0
    def draw_path_collection(self, **props):
        """Add a path collection to data list as a scatter plot.

        Current implementation defaults such collections as scatter plots.
        Matplotlib supports collections that have many of the same parameters
        in common like color, size, path, etc. However, they needn't all be
        the same. Plotly does not currently support such functionality and
        therefore, the style for the first object is taken and used to define
        the remaining paths in the collection.

        props.keys() -- [
        'paths',                (structure: [vertices, path_code])
        'path_coordinates',     ('data', 'axes', 'figure', or 'display')
        'path_transforms',      (mpl transform, including Affine2D matrix)
        'offsets',              (offset from axes, helpful if in 'data')
        'offset_coordinates',   ('data', 'axes', 'figure', or 'display')
        'offset_order',
        'styles',               (style dict, see below)
        'mplobj'                (the collection obj being drawn)
        ]

        props['styles'].keys() -- [
        'linewidth',            (one or more linewidths)
        'facecolor',            (one or more facecolors for path)
        'edgecolor',            (one or more edgecolors for path)
        'alpha',                (one or more opacites for path)
        'zorder',               (precedence when stacked)
        ]

        """
        self.msg += "    Attempting to draw a path collection\n"
        if props['offset_coordinates'] is 'data':
            markerstyle = mpltools.get_markerstyle_from_collection(props)
            scatter_props = {
                'coordinates': 'data',
                'data': props['offsets'],
                'label': None,
                'markerstyle': markerstyle,
                'linestyle': None
            }
            self.msg += "    Drawing path collection as markers\n"
            self.draw_marked_line(**scatter_props)
        else:
            self.msg += "    Path collection not linked to 'data', " \
                        "not drawing\n"
            warnings.warn("Dang! That path collection is out of this "
                          "world. I totally don't know what to do with "
                          "it yet! Plotly can only import path "
                          "collections linked to 'data' coordinates")
示例#3
0
    def draw_path_collection(self, **props):
        """Add a path collection to data list as a scatter plot.

        Current implementation defaults such collections as scatter plots.
        Matplotlib supports collections that have many of the same parameters
        in common like color, size, path, etc. However, they needn't all be
        the same. Plotly does not currently support such functionality and
        therefore, the style for the first object is taken and used to define
        the remaining paths in the collection.

        props.keys() -- [
        'paths',                (structure: [vertices, path_code])
        'path_coordinates',     ('data', 'axes', 'figure', or 'display')
        'path_transforms',      (mpl transform, including Affine2D matrix)
        'offsets',              (offset from axes, helpful if in 'data')
        'offset_coordinates',   ('data', 'axes', 'figure', or 'display')
        'offset_order',
        'styles',               (style dict, see below)
        'mplobj'                (the collection obj being drawn)
        ]

        props['styles'].keys() -- [
        'linewidth',            (one or more linewidths)
        'facecolor',            (one or more facecolors for path)
        'edgecolor',            (one or more edgecolors for path)
        'alpha',                (one or more opacites for path)
        'zorder',               (precedence when stacked)
        ]

        """
        self.msg += "    Attempting to draw a path collection\n"
        if props['offset_coordinates'] is 'data':
            markerstyle = mpltools.get_markerstyle_from_collection(props)
            scatter_props = {
                'coordinates': 'data',
                'data': props['offsets'],
                'label': None,
                'markerstyle': markerstyle,
                'linestyle': None
            }
            self.msg += "    Drawing path collection as markers\n"
            self.draw_marked_line(**scatter_props)
        else:
            self.msg += "    Path collection not linked to 'data', " \
                        "not drawing\n"
            warnings.warn("Dang! That path collection is out of this "
                          "world. I totally don't know what to do with "
                          "it yet! Plotly can only import path "
                          "collections linked to 'data' coordinates")