Render the edge in the given axes. :param ctx: The :class:`_rendering_context` object.
(self, ctx)
| 938 | return x3, y3, x4 - x3, y4 - y3 |
| 939 | |
| 940 | def render(self, ctx): |
| 941 | """ |
| 942 | Render the edge in the given axes. |
| 943 | |
| 944 | :param ctx: |
| 945 | The :class:`_rendering_context` object. |
| 946 | |
| 947 | """ |
| 948 | ax = ctx.ax() |
| 949 | |
| 950 | plot_params = self.plot_params |
| 951 | plot_params["linewidth"] = _pop_multiple( |
| 952 | plot_params, ctx.line_width, "lw", "linewidth" |
| 953 | ) |
| 954 | |
| 955 | plot_params["linestyle"] = plot_params.get("linestyle", "-") |
| 956 | |
| 957 | # Add edge annotation. |
| 958 | if self.label is not None: |
| 959 | x, y, dx, dy = self._get_coords(ctx) |
| 960 | ax.annotate( |
| 961 | self.label, |
| 962 | [x + 0.5 * dx + self.xoffset, y + 0.5 * dy + self.yoffset], |
| 963 | xycoords="data", |
| 964 | xytext=[0, 3], |
| 965 | textcoords="offset points", |
| 966 | ha="center", |
| 967 | va="center", |
| 968 | **self.label_params |
| 969 | ) |
| 970 | |
| 971 | if self.directed: |
| 972 | plot_params["ec"] = _pop_multiple( |
| 973 | plot_params, "k", "ec", "edgecolor" |
| 974 | ) |
| 975 | plot_params["fc"] = _pop_multiple( |
| 976 | plot_params, "k", "fc", "facecolor" |
| 977 | ) |
| 978 | plot_params["head_length"] = plot_params.get("head_length", 0.25) |
| 979 | plot_params["head_width"] = plot_params.get("head_width", 0.1) |
| 980 | |
| 981 | # Build an arrow. |
| 982 | args = self._get_coords(ctx) |
| 983 | |
| 984 | # zero lengh arrow produce error |
| 985 | if not (args[2] == 0.0 and args[3] == 0.0): |
| 986 | ar = FancyArrow( |
| 987 | *self._get_coords(ctx), |
| 988 | width=0, |
| 989 | length_includes_head=True, |
| 990 | **plot_params |
| 991 | ) |
| 992 | |
| 993 | # Add the arrow to the axes. |
| 994 | ax.add_artist(ar) |
| 995 | return ar |
| 996 | |
| 997 | else: |
nothing calls this directly
no test coverage detected