A fancy arrow patch. It draws an arrow using the `ArrowStyle`. It is primarily used by the `~.axes.Axes.annotate` method. For most purposes, use the annotate method for drawing arrows. The head and tail positions are fixed at the specified start and end points of the arro
| 4279 | |
| 4280 | |
| 4281 | class FancyArrowPatch(Patch): |
| 4282 | """ |
| 4283 | A fancy arrow patch. |
| 4284 | |
| 4285 | It draws an arrow using the `ArrowStyle`. It is primarily used by the |
| 4286 | `~.axes.Axes.annotate` method. For most purposes, use the annotate method for |
| 4287 | drawing arrows. |
| 4288 | |
| 4289 | The head and tail positions are fixed at the specified start and end points |
| 4290 | of the arrow, but the size and shape (in display coordinates) of the arrow |
| 4291 | does not change when the axis is moved or zoomed. |
| 4292 | """ |
| 4293 | _edge_default = True |
| 4294 | |
| 4295 | def __str__(self): |
| 4296 | if self._posA_posB is not None: |
| 4297 | (x1, y1), (x2, y2) = self._posA_posB |
| 4298 | return f"{type(self).__name__}(({x1:g}, {y1:g})->({x2:g}, {y2:g}))" |
| 4299 | else: |
| 4300 | return f"{type(self).__name__}({self._path_original})" |
| 4301 | |
| 4302 | @_docstring.interpd |
| 4303 | def __init__(self, posA=None, posB=None, *, |
| 4304 | path=None, arrowstyle="simple", connectionstyle="arc3", |
| 4305 | patchA=None, patchB=None, shrinkA=2, shrinkB=2, |
| 4306 | mutation_scale=1, mutation_aspect=1, **kwargs): |
| 4307 | """ |
| 4308 | **Defining the arrow position and path** |
| 4309 | |
| 4310 | There are two ways to define the arrow position and path: |
| 4311 | |
| 4312 | - **Start, end and connection**: |
| 4313 | The typical approach is to define the start and end points of the |
| 4314 | arrow using *posA* and *posB*. The curve between these two can |
| 4315 | further be configured using *connectionstyle*. |
| 4316 | |
| 4317 | If given, the arrow curve is clipped by *patchA* and *patchB*, |
| 4318 | allowing it to start/end at the border of these patches. |
| 4319 | Additionally, the arrow curve can be shortened by *shrinkA* and *shrinkB* |
| 4320 | to create a margin between start/end (after possible clipping) and the |
| 4321 | drawn arrow. |
| 4322 | |
| 4323 | - **path**: Alternatively if *path* is provided, an arrow is drawn along |
| 4324 | this Path. In this case, *connectionstyle*, *patchA*, *patchB*, |
| 4325 | *shrinkA*, and *shrinkB* are ignored. |
| 4326 | |
| 4327 | **Styling** |
| 4328 | |
| 4329 | The *arrowstyle* defines the styling of the arrow head, tail and shaft. |
| 4330 | The resulting arrows can be styled further by setting the `.Patch` |
| 4331 | properties such as *linewidth*, *color*, *facecolor*, *edgecolor* |
| 4332 | etc. via keyword arguments. |
| 4333 | |
| 4334 | Parameters |
| 4335 | ---------- |
| 4336 | posA, posB : (float, float), optional |
| 4337 | (x, y) coordinates of start and end point of the arrow. |
| 4338 | The actually drawn start and end positions may be modified |
no outgoing calls
searching dependent graphs…