KekLib.OurMatplotlib3D#

OurMatplotlib3D.py

modified from https://stackoverflow.com/questions/18228966/how-can-matplotlib-2d-patches-be-transformed-to-3d-with-arbitrary-normals/18228967

Copyright (c) 2018-2020, SAXS Team, KEK-PF

class Inset2Din3D(ax, inset_box)#

Bases: object

draw(*args)#
get_axis()#
set_annotation_lines(p1, p2)#
set_event_handler()#
demo_pathpatch_2d_to_3d()#
inset_3d_demo()#
parallelogram(origin, v1, v2)#
pathpatch_2d_to_3d(pathpatch, z=0, normal='z')#

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.

pathpatch_translate(pathpatch, delta)#

Translates the 3D pathpatch by the amount delta.

plot_cube(ax, origin, r, **kwargs)#
plot_parallelepiped(ax, origin, vectors, color=None, edgecolor='w', alpha=1)#
plot_parallelogram3d(ax, p0, p1, p2, **kwargs)#
plot_sphere(ax, center, r, n=100, **kwargs)#

[matplotlib animation] 3.Z-axis rotation animation of the sphere https://sabopy.com/en/matplotlib-animation-3/

rotation_matrix(d)#

Calculates a rotation matrix given a vector d. The direction of d corresponds to the rotation axis. The length of d corresponds to the sin of the angle of rotation.

Variant of: http://mail.scipy.org/pipermail/numpy-discussion/2009-March/040806.html

simply_to_3d(pathpatch, verts)#