<s> from matplotlib import pyplot <EOL> from shapely . geometry import LineString <EOL> from descartes import PolygonPatch <EOL> from figures import SIZE , BLUE , GRAY <EOL> def plot_coords ( ax , x , y , color = '<STR_LIT>' , zorder = <NUM_LIT:1> ) : <EOL> ax . plot ( x , y , '<STR_LIT:o>' , color = color , zorder = zorder ) <EOL> def plot_line ( ax , ob , color = GRAY ) : <EOL> parts = hasattr ( ob , '<STR_LIT>' ) and ob or [ ob ] <EOL> for part in parts : <EOL> x , y = part . xy <EOL> ax . plot ( x , y , color = color , linewidth = <NUM_LIT:3> , solid_capstyle = '<STR_LIT>' , zorder = <NUM_LIT:1> ) <EOL> def set_limits ( ax , x_range , y_range ) : <EOL> ax . set_xlim ( * x_range ) <EOL> ax . set_xticks ( range ( * x_range ) + [ x_range [ - <NUM_LIT:1> ] ] ) <EOL> ax . set_ylim ( * y_range ) <EOL> ax . set_yticks ( range ( * y_range ) + [ y_range [ - <NUM_LIT:1> ] ] ) <EOL> ax . set_aspect ( <NUM_LIT:1> ) <EOL> line = LineString ( [ ( <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:0> , <NUM_LIT:2> ) , ( <NUM_LIT:2> , <NUM_LIT:2> ) , ( <NUM_LIT:3> , <NUM_LIT:1> ) , ( <NUM_LIT:1> , <NUM_LIT:0> ) ] ) <EOL> line_bounds = line . bounds <EOL> ax_range = [ int ( line_bounds [ <NUM_LIT:0> ] - <NUM_LIT:1.0> ) , int ( line_bounds [ <NUM_LIT:2> ] + <NUM_LIT:1.0> ) ] <EOL> ay_range = [ int ( line_bounds [ <NUM_LIT:1> ] - <NUM_LIT:1.0> ) , int ( line_bounds [ <NUM_LIT:3> ] + <NUM_LIT:1.0> ) ] <EOL> fig = pyplot . figure ( <NUM_LIT:1> , figsize = ( SIZE [ <NUM_LIT:0> ] , <NUM_LIT:2> * SIZE [ <NUM_LIT:1> ] ) , dpi = <NUM_LIT> ) <EOL> ax = fig . add_subplot ( <NUM_LIT> ) <EOL> plot_line ( ax , line ) <EOL> x , y = list ( line . coords ) [ <NUM_LIT:0> ] <EOL> plot_coords ( ax , x , y ) <EOL> offset = line . parallel_offset ( <NUM_LIT:0.5> , '<STR_LIT:left>' , join_style = <NUM_LIT:2> , mitre_limit = <NUM_LIT:0.1> ) <EOL> plot_line ( ax , offset , color = BLUE ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> set_limits ( ax , ax_range , ay_range ) <EOL> ax = fig . add_subplot ( <NUM_LIT> ) <EOL> plot_line ( ax , line ) <EOL> x , y = list ( line . coords ) [ <NUM_LIT:0> ] <EOL> plot_coords ( ax , x , y ) <EOL> offset = line . parallel_offset ( <NUM_LIT:0.5> , '<STR_LIT:left>' , join_style = <NUM_LIT:2> , mitre_limit = <NUM_LIT> ) <EOL> plot_line ( ax , offset , color = BLUE ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> set_limits ( ax , ax_range , ay_range ) <EOL> ax = fig . add_subplot ( <NUM_LIT> ) <EOL> plot_line ( ax , line ) <EOL> x , y = list ( line . coords ) [ <NUM_LIT:0> ] <EOL> plot_coords ( ax , x , y ) <EOL> offset = line . parallel_offset ( <NUM_LIT:0.5> , '<STR_LIT:right>' , join_style = <NUM_LIT:2> , mitre_limit = <NUM_LIT:0.1> ) <EOL> plot_line ( ax , offset , color = BLUE ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> set_limits ( ax , ax_range , ay_range ) <EOL> ax = fig . add_subplot ( <NUM_LIT> ) <EOL> plot_line ( ax , line ) <EOL> x , y = list ( line . coords ) [ <NUM_LIT:0> ] <EOL> plot_coords ( ax , x , y ) <EOL> offset = line . parallel_offset ( <NUM_LIT:0.5> , '<STR_LIT:right>' , join_style = <NUM_LIT:2> , mitre_limit = <NUM_LIT> ) <EOL> plot_line ( ax , offset , color = BLUE ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> set_limits ( ax , ax_range , ay_range ) <EOL> pyplot . show ( ) </s>
