@staticmethod<EOL><INDENT>def grasp(grasp, width=None, color='<STR_LIT:r>', arrow_len=<NUM_LIT:4>, arrow_head_len = <NUM_LIT:2>, arrow_head_width = <NUM_LIT:3>,<EOL>arrow_width = <NUM_LIT:1>, jaw_len=<NUM_LIT:3>, jaw_width = <NUM_LIT:1.0>,<EOL>grasp_center_size=<NUM_LIT:1>, grasp_center_thickness=<NUM_LIT>,<EOL>grasp_center_style='<STR_LIT:+>', grasp_axis_width=<NUM_LIT:1>,<EOL>grasp_axis_style='<STR_LIT>', line_width=<NUM_LIT:1.0>, alpha=<NUM_LIT:50>, show_center=True, show_axis=False, scale=<NUM_LIT:1.0>):<DEDENT>
<EOL>skip_jaws = False<EOL>if not hasattr(grasp, '<STR_LIT:width>'):<EOL><INDENT>grasp_center_style = '<STR_LIT:.>'<EOL>grasp_center_size = <NUM_LIT:50><EOL>plt.scatter(grasp.center.x, grasp.center.y, c=color, marker=grasp_center_style, s=scale*grasp_center_size)<EOL>if hasattr(grasp, '<STR_LIT>'):<EOL><INDENT>axis = np.array([np.cos(grasp.angle), np.sin(grasp.angle)])<EOL>p = grasp.center.data + alpha * axis<EOL>line = np.c_[grasp.center.data, p]<EOL>plt.plot(line[<NUM_LIT:0>,:], line[<NUM_LIT:1>,:], color=color, linewidth=scale*grasp_axis_width)<EOL>plt.scatter(p[<NUM_LIT:0>], p[<NUM_LIT:1>], c=color, marker=grasp_center_style, s=scale*grasp_center_size)<EOL><DEDENT>return<EOL><DEDENT>if show_center:<EOL><INDENT>plt.plot(grasp.center.x, grasp.center.y, c=color, marker=grasp_center_style, mew=scale*grasp_center_thickness, ms=scale*grasp_center_size)<EOL><DEDENT>if skip_jaws:<EOL><INDENT>return<EOL><DEDENT>axis = grasp.axis<EOL>width_px = width<EOL>if width_px is None and hasattr(grasp, '<STR_LIT>'):<EOL><INDENT>width_px = grasp.width_px<EOL><DEDENT>g1 = grasp.center.data - (float(width_px) / <NUM_LIT:2>) * axis<EOL>g2 = grasp.center.data + (float(width_px) / <NUM_LIT:2>) * axis<EOL>g1p = g1 - scale * arrow_len * axis <EOL>g2p = g2 + scale * arrow_len * axis <EOL>if show_axis:<EOL><INDENT>plt.plot([g1[<NUM_LIT:0>], g2[<NUM_LIT:0>]], [g1[<NUM_LIT:1>], g2[<NUM_LIT:1>]], color=color, linewidth=scale*grasp_axis_width, linestyle=grasp_axis_style)<EOL><DEDENT>jaw_dir = scale * jaw_len * np.array([axis[<NUM_LIT:1>], -axis[<NUM_LIT:0>]])<EOL>alpha = scale*(arrow_len - arrow_head_len)<EOL>g1_line = np.c_[g1p, g1 - scale*arrow_head_len*axis].T<EOL>plt.arrow(g1p[<NUM_LIT:0>], g1p[<NUM_LIT:1>], alpha*axis[<NUM_LIT:0>], alpha*axis[<NUM_LIT:1>], width=scale*arrow_width, head_width=scale*arrow_head_width, head_length=scale*arrow_head_len, fc=color, ec=color)<EOL>jaw_line1 = np.c_[g1 + jaw_dir, g1 - jaw_dir].T<EOL>plt.plot(jaw_line1[:,<NUM_LIT:0>], jaw_line1[:,<NUM_LIT:1>], linewidth=scale*jaw_width, c=color) <EOL>g2_line = np.c_[g2p, g2 + scale*arrow_head_len*axis].T<EOL>plt.arrow(g2p[<NUM_LIT:0>], g2p[<NUM_LIT:1>], -alpha*axis[<NUM_LIT:0>], -alpha*axis[<NUM_LIT:1>], width=scale*arrow_width, head_width=scale*arrow_head_width, head_length=scale*arrow_head_len, fc=color, ec=color)<EOL>jaw_line2 = np.c_[g2 + jaw_dir, g2 - jaw_dir].T<EOL>plt.plot(jaw_line2[:,<NUM_LIT:0>], jaw_line2[:,<NUM_LIT:1>], linewidth=scale*jaw_width, c=color)<EOL>
Plots a 2D grasp with arrow and jaw style using matplotlib

Parameters
----------
grasp : :obj:`Grasp2D`
    2D grasp to plot
width : float
    width, in pixels, of the grasp (overrides Grasp2D.width_px)
color : :obj:`str`
    color of plotted grasp
arrow_len : float
    length of arrow body
arrow_head_len : float
    length of arrow head
arrow_head_width : float
    width of arrow head
arrow_width : float
    width of arrow body
jaw_len : float
    length of jaw line
jaw_width : float
    line width of jaw line
grasp_center_thickness : float
    thickness of grasp center
grasp_center_style : :obj:`str`
    style of center of grasp
grasp_axis_width : float
    line width of grasp axis
grasp_axis_style : :obj:`str`
    style of grasp axis line
show_center : bool
    whether or not to plot the grasp center
show_axis : bool
    whether or not to plot the grasp axis