def pathpatch_2d_to_3d(pathpatch, z = <NUM_LIT:0>, normal = '<STR_LIT:z>'):
if type(normal) is str: <EOL><INDENT>index = "<STR_LIT>".index(normal)<EOL>normal = np.roll((<NUM_LIT:1.0>,<NUM_LIT:0>,<NUM_LIT:0>), index)<EOL><DEDENT>normal /= np.linalg.norm(normal) <EOL>path = pathpatch.get_path() <EOL>trans = pathpatch.get_patch_transform()<EOL>path = trans.transform_path(path) <EOL>pathpatch.__class__ = art3d.PathPatch3D <EOL>pathpatch._code3d = path.codes <EOL>pathpatch._facecolor3d = pathpatch.get_facecolor <EOL>verts = path.vertices <EOL>d = np.cross(normal, (<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>)) <EOL>M = rotation_matrix(d) <EOL>pathpatch._segment3d =np.array([np.dot(M, (x, y, <NUM_LIT:0>)) + (<NUM_LIT:0>, <NUM_LIT:0>, z) for x, y in verts])<EOL>return pathpatch<EOL>
Transforms a 2D Patch to a 3D patch using the given normal vector.

The patch is projected into they XY plane, rotated about the origin
and finally translated by z.