def plot_chain(chain, joints, ax, target=None, show=False):
<EOL>nodes = []<EOL>axes = []<EOL>transformation_matrixes = chain.forward_kinematics(joints, full_kinematics=True)<EOL>for (index, link) in enumerate(chain.links):<EOL><INDENT>(node, rotation) = geometry_utils.from_transformation_matrix(transformation_matrixes[index])<EOL>nodes.append(node)<EOL>rotation_axis = link._get_rotation_axis()<EOL>if index == <NUM_LIT:0>:<EOL><INDENT>axes.append(rotation_axis)<EOL><DEDENT>else:<EOL><INDENT>axes.append(geometry_utils.homogeneous_to_cartesian_vectors(np.dot(transformation_matrixes[index - <NUM_LIT:1>], rotation_axis)))<EOL><DEDENT><DEDENT>ax.plot([x[<NUM_LIT:0>] for x in nodes], [x[<NUM_LIT:1>] for x in nodes], [x[<NUM_LIT:2>] for x in nodes])<EOL>ax.scatter([x[<NUM_LIT:0>] for x in nodes], [x[<NUM_LIT:1>] for x in nodes], [x[<NUM_LIT:2>] for x in nodes])<EOL>for index, axe in enumerate(axes):<EOL><INDENT>ax.plot([nodes[index][<NUM_LIT:0>], axe[<NUM_LIT:0>]], [nodes[index][<NUM_LIT:1>], axe[<NUM_LIT:1>]], [nodes[index][<NUM_LIT:2>], axe[<NUM_LIT:2>]])<EOL><DEDENT>
Plots the chain