Plots the string *s* on the Axes *ax*, with position *xyz*, size *size*, and rotation angle *angle*. *zdir* gives the axis which is to be treated as the third dimension. *usetex* is a boolean indicating whether the string should be run through a LaTeX subprocess or not. Any additio
(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs)
| 16 | |
| 17 | |
| 18 | def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs): |
| 19 | """ |
| 20 | Plots the string *s* on the Axes *ax*, with position *xyz*, size *size*, |
| 21 | and rotation angle *angle*. *zdir* gives the axis which is to be treated as |
| 22 | the third dimension. *usetex* is a boolean indicating whether the string |
| 23 | should be run through a LaTeX subprocess or not. Any additional keyword |
| 24 | arguments are forwarded to `.transform_path`. |
| 25 | |
| 26 | Note: zdir affects the interpretation of xyz. |
| 27 | """ |
| 28 | x, y, z = xyz |
| 29 | if zdir == "y": |
| 30 | xy1, z1 = (x, z), y |
| 31 | elif zdir == "x": |
| 32 | xy1, z1 = (y, z), x |
| 33 | else: |
| 34 | xy1, z1 = (x, y), z |
| 35 | |
| 36 | text_path = TextPath((0, 0), s, size=size, usetex=usetex) |
| 37 | trans = Affine2D().rotate(angle).translate(xy1[0], xy1[1]) |
| 38 | |
| 39 | p1 = PathPatch(trans.transform_path(text_path), **kwargs) |
| 40 | ax.add_patch(p1) |
| 41 | art3d.pathpatch_2d_to_3d(p1, z=z1, zdir=zdir) |
| 42 | |
| 43 | |
| 44 | fig = plt.figure() |
no test coverage detected
searching dependent graphs…