當前位置: 首頁>>代碼示例>>Python>>正文


Python patches.FancyArrowPatch方法代碼示例

本文整理匯總了Python中matplotlib.patches.FancyArrowPatch方法的典型用法代碼示例。如果您正苦於以下問題:Python patches.FancyArrowPatch方法的具體用法?Python patches.FancyArrowPatch怎麽用?Python patches.FancyArrowPatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.patches的用法示例。


在下文中一共展示了patches.FancyArrowPatch方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: update_bbox_position_size

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def update_bbox_position_size(self, renderer):
        """
        Update the location and the size of the bbox. This method
        should be used when the position and size of the bbox needs to
        be updated before actually drawing the bbox.
        """

        # For arrow_patch, use textbox as patchA by default.

        if not isinstance(self.arrow_patch, FancyArrowPatch):
            return

        if self._bbox_patch:
            posx, posy = self._x, self._y

            x_box, y_box, w_box, h_box = _get_textbox(self, renderer)
            self._bbox_patch.set_bounds(0., 0., w_box, h_box)
            theta = np.deg2rad(self.get_rotation())
            tr = mtransforms.Affine2D().rotate(theta)
            tr = tr.translate(posx + x_box, posy + y_box)
            self._bbox_patch.set_transform(tr)
            fontsize_in_pixel = renderer.points_to_pixels(self.get_size())
            self._bbox_patch.set_mutation_scale(fontsize_in_pixel) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:25,代碼來源:text.py

示例2: __prepare_fancyarrow_dpi_cor_test

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def __prepare_fancyarrow_dpi_cor_test():
    """
    Convenience function that prepares and returns a FancyArrowPatch. It aims
    at being used to test that the size of the arrow head does not depend on
    the DPI value of the exported picture.

    NB: this function *is not* a test in itself!
    """
    fig2 = plt.figure("fancyarrow_dpi_cor_test", figsize=(4, 3), dpi=50)
    ax = fig2.add_subplot(111)
    ax.set_xlim([0, 1])
    ax.set_ylim([0, 1])
    ax.add_patch(mpatches.FancyArrowPatch(posA=(0.3, 0.4), posB=(0.8, 0.6),
                                          lw=3, arrowstyle='->',
                                          mutation_scale=100))
    return fig2 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:18,代碼來源:test_arrow_patches.py

示例3: test_fancyarrow_dash

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def test_fancyarrow_dash():
    from matplotlib.patches import FancyArrowPatch
    fig, ax = plt.subplots()

    e = FancyArrowPatch((0, 0), (0.5, 0.5),
                        arrowstyle='-|>',
                        connectionstyle='angle3,angleA=0,angleB=90',
                        mutation_scale=10.0,
                        linewidth=2,
                        linestyle='dashed',
                        color='k')

    e2 = FancyArrowPatch((0, 0), (0.5, 0.5),
                         arrowstyle='-|>',
                         connectionstyle='angle3',
                         mutation_scale=10.0,
                         linewidth=2,
                         linestyle='dotted',
                         color='k')
    ax.add_patch(e)
    ax.add_patch(e2) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:23,代碼來源:test_arrow_patches.py

示例4: create_edge_patch

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def create_edge_patch(
    posA,
    posB,
    width=1,
    node_rad=0,
    connectionstyle="arc3, rad=0.25",
    facecolor="k",
    **kwargs
):
    import matplotlib.patches as pat

    style = "simple,head_length=%d,head_width=%d,tail_width=%d" % (10, 10, 3 * width)
    return pat.FancyArrowPatch(
        posA=posA,
        posB=posB,
        arrowstyle=style,
        connectionstyle=connectionstyle,
        facecolor=facecolor,
        shrinkA=node_rad,
        shrinkB=node_rad,
        **kwargs
    ) 
開發者ID:aristoteleo,項目名稱:dynamo-release,代碼行數:24,代碼來源:state_graph.py

示例5: __prepare_fancyarrow_dpi_cor_test

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def __prepare_fancyarrow_dpi_cor_test():
    """
    Convenience function that prepares and returns a FancyArrowPatch. It aims
    at being used to test that the size of the arrow head does not depend on
    the DPI value of the exported picture.

    NB: this function *is not* a test in itself!
    """
    fig2 = plt.figure("fancyarrow_dpi_cor_test", figsize=(4, 3), dpi=50)
    ax = fig2.add_subplot(111)
    ax.set_xlim([0, 1])
    ax.set_ylim([0, 1])
    ax.add_patch(mpatches.FancyArrowPatch(posA=(0.3, 0.4), posB=(0.8, 0.6),
                                          lw=3, arrowstyle=u'->',
                                          mutation_scale=100))
    return fig2 
開發者ID:alvarobartt,項目名稱:twitter-stock-recommendation,代碼行數:18,代碼來源:test_arrow_patches.py

示例6: _draw_without_key_connections

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def _draw_without_key_connections(dna_helix_graph, node_size_pixels,
                                  nucleotide_positions, subplot
                                  ) -> List[patches.FancyArrowPatch]:
    edge_patches = nx.draw_networkx_edges(
        dna_helix_graph, pos=nucleotide_positions,
        node_size=node_size_pixels, ax=subplot)
    return edge_patches 
開發者ID:audi,項目名稱:nucleus7,代碼行數:9,代碼來源:vis_utils.py

示例7: _draw_with_key_connections

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def _draw_with_key_connections(dna_helix_graph, nucleotide_plots, subplot
                               ) -> List[patches.FancyArrowPatch]:
    edge_patches = []
    for each_nucleotide in dna_helix_graph:
        edge_patches_for_nucleotide = _draw_nucleotide_keys_connections(
            each_nucleotide, dna_helix_graph, nucleotide_plots)
        if edge_patches_for_nucleotide:
            edge_patches.extend(edge_patches_for_nucleotide)
    for each_edge_patch in edge_patches:
        subplot.add_patch(each_edge_patch)
    return edge_patches 
開發者ID:audi,項目名稱:nucleus7,代碼行數:13,代碼來源:vis_utils.py

示例8: _draw_nucleotide_keys_connections

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def _draw_nucleotide_keys_connections(nucleotide, dna_helix_graph,
                                      nucleotide_plots
                                      ) -> List[patches.FancyArrowPatch]:
    edge_patches_for_nucleotide = []
    predecessors = dna_helix_graph.predecessors(nucleotide)
    successors = dna_helix_graph.successors(nucleotide)
    for each_inbound_nucleotide in predecessors:
        edge_patches = _draw_key_connections_for_nucleotide_pair(
            nucleotide, each_inbound_nucleotide, nucleotide_plots)
        edge_patches_for_nucleotide.extend(edge_patches)
    for each_outgoing_nucleotide in successors:
        edge_patches = _draw_key_connections_for_nucleotide_pair(
            each_outgoing_nucleotide, nucleotide, nucleotide_plots)
        edge_patches_for_nucleotide.extend(edge_patches)
    return edge_patches_for_nucleotide 
開發者ID:audi,項目名稱:nucleus7,代碼行數:17,代碼來源:vis_utils.py

示例9: _draw_key_connections_for_nucleotide_pair

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def _draw_key_connections_for_nucleotide_pair(
        nucleotide: Nucleotide,
        inbound_nucleotide: Nucleotide,
        nucleotide_plots: Dict[Nucleotide, _NUCLEOTIDE_PLOT]
) -> List[patches.FancyArrowPatch]:
    nucleotide_plot = nucleotide_plots[nucleotide]
    incoming_nucleotide_plot = nucleotide_plots[inbound_nucleotide]

    inputs_to_nucleotide = {each_inbound_node: {"": None}
                            for each_inbound_node in nucleotide.inbound_nodes}
    inputs_to_nucleotide[inbound_nucleotide.name] = {
        k: k for k in inbound_nucleotide.generated_keys_all}

    inputs_to_nucleotide_filtered = nucleotide.filter_inputs(
        inputs_to_nucleotide)
    if "" in inputs_to_nucleotide_filtered:
        del inputs_to_nucleotide_filtered[""]

    edge_patches = []
    for each_incoming_key, each_generated_key in (
            inputs_to_nucleotide_filtered.items()):
        edge_patch = _draw_edge_between_keys(
            nucleotide, inbound_nucleotide,
            each_incoming_key, each_generated_key,
            nucleotide_plot, incoming_nucleotide_plot)
        edge_patches.append(edge_patch)
    return edge_patches 
開發者ID:audi,項目名稱:nucleus7,代碼行數:29,代碼來源:vis_utils.py

示例10: test_fancyarrow_dpi_cor_100dpi

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def test_fancyarrow_dpi_cor_100dpi():
    """
    Check the export of a FancyArrowPatch @ 100 DPI. FancyArrowPatch is
    instantiated through a dedicated function because another similar test
    checks a similar export but with a different DPI value.

    Remark: test only a rasterized format.
    """

    __prepare_fancyarrow_dpi_cor_test() 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:12,代碼來源:test_arrow_patches.py

示例11: test_arrow_styles

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def test_arrow_styles():
    styles = mpatches.ArrowStyle.get_styles()

    n = len(styles)
    fig, ax = plt.subplots(figsize=(6, 10))
    ax.set_xlim(0, 1)
    ax.set_ylim(-1, n)

    for i, stylename in enumerate(sorted(styles)):
        patch = mpatches.FancyArrowPatch((0.1, i), (0.8, i),
                                         arrowstyle=stylename,
                                         mutation_scale=25)
        ax.add_patch(patch) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:15,代碼來源:test_arrow_patches.py

示例12: test_invalid_intersection

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def test_invalid_intersection():
    conn_style_1 = mpatches.ConnectionStyle.Angle3(angleA=20, angleB=200)
    p1 = mpatches.FancyArrowPatch((.2, .2), (.5, .5),
                                  connectionstyle=conn_style_1)
    with pytest.raises(ValueError):
        plt.gca().add_patch(p1)

    conn_style_2 = mpatches.ConnectionStyle.Angle3(angleA=20, angleB=199.9)
    p2 = mpatches.FancyArrowPatch((.2, .2), (.5, .5),
                                  connectionstyle=conn_style_2)
    plt.gca().add_patch(p2) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:13,代碼來源:test_arrow_patches.py

示例13: add_arrow

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def add_arrow(ax, tailhead, **kwargs):
	arrowDict = dict(linewidth=1., color='k', arrowstyle='-|>', mutation_scale=12 * 1)
	arrowDict.update(kwargs)
	p = patches.FancyArrowPatch(tailhead[0], tailhead[1], transform=ax.transData, **arrowDict)
	ax.add_patch(p) 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:7,代碼來源:tools.py

示例14: set_arrow_alpha

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def set_arrow_alpha(ax=None, alpha=1):
    from matplotlib import patches
    ax = plt.gca() if ax is None else ax

    # iterate through the children of ax
    for art in ax.get_children():
        # we are only interested in FancyArrowPatches
        if not isinstance(art, patches.FancyArrowPatch):
            continue
        art.set_alpha(alpha) 
開發者ID:aristoteleo,項目名稱:dynamo-release,代碼行數:12,代碼來源:utils.py

示例15: draw

# 需要導入模塊: from matplotlib import patches [as 別名]
# 或者: from matplotlib.patches import FancyArrowPatch [as 別名]
def draw(self):
        style = ArrowStyle("Simple, head_length=.1, head_width=.1, tail_width=.01")
        arrow = FancyArrowPatch(self.point[:2], (self.point + self.vector)[:2],
                                arrowstyle=style,
                                edgecolor=self.color,
                                facecolor=self.color,
                                zorder=self.zorder,
                                mutation_scale=100)
        if self._draw_point:
            self.point_artist = self.plotter.add(self.point)
        self.mpl_vector = self.plotter.axes.add_patch(arrow) 
開發者ID:compas-dev,項目名稱:compas,代碼行數:13,代碼來源:vectorartist.py


注:本文中的matplotlib.patches.FancyArrowPatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。