`ConnectionStyle` is a container class which defines several connectionstyle classes, which is used to create a path between two points. These are mainly used with `FancyArrowPatch`. A connectionstyle object can be either created as:: ConnectionStyle.Arc3(rad=0.2)
| 2890 | |
| 2891 | @_docstring.interpd |
| 2892 | class ConnectionStyle(_Style): |
| 2893 | """ |
| 2894 | `ConnectionStyle` is a container class which defines |
| 2895 | several connectionstyle classes, which is used to create a path |
| 2896 | between two points. These are mainly used with `FancyArrowPatch`. |
| 2897 | |
| 2898 | A connectionstyle object can be either created as:: |
| 2899 | |
| 2900 | ConnectionStyle.Arc3(rad=0.2) |
| 2901 | |
| 2902 | or:: |
| 2903 | |
| 2904 | ConnectionStyle("Arc3", rad=0.2) |
| 2905 | |
| 2906 | or:: |
| 2907 | |
| 2908 | ConnectionStyle("Arc3, rad=0.2") |
| 2909 | |
| 2910 | The following classes are defined |
| 2911 | |
| 2912 | %(ConnectionStyle:table)s |
| 2913 | |
| 2914 | An instance of any connection style class is a callable object, |
| 2915 | whose call signature is:: |
| 2916 | |
| 2917 | __call__(self, posA, posB, |
| 2918 | patchA=None, patchB=None, |
| 2919 | shrinkA=2., shrinkB=2.) |
| 2920 | |
| 2921 | and it returns a `.Path` instance. *posA* and *posB* are |
| 2922 | tuples of (x, y) coordinates of the two points to be |
| 2923 | connected. *patchA* (or *patchB*) is given, the returned path is |
| 2924 | clipped so that it start (or end) from the boundary of the |
| 2925 | patch. The path is further shrunk by *shrinkA* (or *shrinkB*) |
| 2926 | which is given in points. |
| 2927 | """ |
| 2928 | |
| 2929 | _style_list = {} |
| 2930 | |
| 2931 | class _Base: |
| 2932 | """ |
| 2933 | A base class for connectionstyle classes. The subclass needs |
| 2934 | to implement a *connect* method whose call signature is:: |
| 2935 | |
| 2936 | connect(posA, posB) |
| 2937 | |
| 2938 | where posA and posB are tuples of x, y coordinates to be |
| 2939 | connected. The method needs to return a path connecting two |
| 2940 | points. This base class defines a __call__ method, and a few |
| 2941 | helper methods. |
| 2942 | """ |
| 2943 | def _in_patch(self, patch): |
| 2944 | """ |
| 2945 | Return a predicate function testing whether a point *xy* is |
| 2946 | contained in *patch*. |
| 2947 | """ |
| 2948 | return lambda xy: patch.contains( |
| 2949 | SimpleNamespace(x=xy[0], y=xy[1]))[0] |
no outgoing calls
no test coverage detected
searching dependent graphs…