Changeset 12330


Ignore:
Timestamp:
07/05/2009 04:04:43 PM (14 months ago)
Author:
dstn
Message:

reduce inter-level spacing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/kdtree-tests/tree-figs.py

    r12327 r12330  
    2626                endfig() 
    2727 
     28 
    2829def get_axis_sizes(levels): 
    2930        # x offset 
     
    3233        # y offset 
    3334        Hoff = 0.0025 
    34         Hspace = 0.03 
     35        #Hspace = 0.03 
     36        Hspace = 0.01 
    3537        Haxes = ((1. - 2*Hoff) - (levels-1)*Hspace) / float(levels) 
    3638        #print 'Haxes', Haxes, 'Waxes', Waxes, 'Hspace', Hspace 
     
    7779                xticks([],[]) 
    7880                yticks([],[]) 
    79                 axis('equal') 
     81                #axis('equal') 
    8082                axis(ax) 
    8183                gca().frame.set_edgecolor('0.5') 
     
    8587        a = gcf().add_axes([0,0,1,1], axisbg='r') 
    8688        a.set_frame_on(False) 
     89 
     90        #for lev in range(levels): 
     91        #       (x1,y1) = transform(lev, ax[0], ax[2]) 
     92        #       (x2,y2) = transform(lev, ax[1], ax[3]) 
     93        #       plot([x1,x2],[y1,y2], 'r.-') 
    8794        for lev in range(levels-1): 
    8895                bbparents  = bboxes[lev] 
     
    94101                                (cx, cy) = transform(lev+1, (bbchild [0]+bbchild [2])/2, (bbchild [1]+bbchild [3])/2) 
    95102                                # nothing is quite as much fun as doing your own line clipping... 
    96                                 # (so that the connecting lines come from the centers of the boxes) 
     103                                # (so that the connecting lines come from the centers of the boxes but end at the box edges) 
    97104                                (nilx, clip_py) = transform(lev,   0, bbparent[1]) 
    98105                                (nilx, clip_cy) = transform(lev+1, 0, bbchild [3]) 
     
    101108                                clip1 = (clip_py - py) / dy 
    102109                                clip2 = (clip_cy - py) / dy 
    103  
     110                                #plot([px,cx], [py,cy], 'r-') 
    104111                                plot([px + clip1*dx, px + clip2*dx], 
    105112                                         [py + clip1*dy, py + clip2*dy], 
     
    158165                xticks([],[]) 
    159166                yticks([],[]) 
    160                 axis('equal') 
     167                #axis('equal') 
    161168                axis(ax) 
    162169                gca().frame.set_edgecolor('0.5') 
     
    180187                                        plot([o[0], o[2]], [sval, sval], **style) 
    181188 
    182                 axis('equal') 
     189                #axis('equal') 
    183190                axis(ax) 
    184191 
     
    197204        #plot_bboxes(data, t.bboxes, 6, [-0.03, 1.03, -0.03, 1.03]) 
    198205 
    199         #plot_bbox_tree(data, t.bboxes, 4) 
    200  
     206        plot_bbox_tree(data, t.bboxes, 4) 
    201207        rootbb = (t.bboxes[0])[0] 
    202208        plot_split_tree(data, rootbb, t.splits, 4) 
    203209 
    204         sys.exit(0) 
    205  
     210 
Note: See TracChangeset for help on using the changeset viewer.