MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / text3d

Function text3d

galleries/examples/mplot3d/pathpatch3d.py:18–41  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

16
17
18def 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
44fig = plt.figure()

Callers 1

pathpatch3d.pyFile · 0.85

Calls 7

TextPathClass · 0.90
Affine2DClass · 0.90
PathPatchClass · 0.90
translateMethod · 0.80
add_patchMethod · 0.80
rotateMethod · 0.45
transform_pathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…