Changeset 11848:9777949fbab1 in orange


Ignore:
Timestamp:
01/29/14 03:13:04 (3 months ago)
Author:
Miha Stajdohar <miha.stajdohar@…>
Branch:
default
Message:

Fixed anchors bug Polyviz scaling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/data/preprocess/scaling.py

    r11633 r11848  
    13531353            yanchors = self.create_yanchors(len(attr_indices)) 
    13541354 
    1355         xanchors = numpy.zeros(numpy.shape(selected_data), numpy.float) 
    1356         yanchors = numpy.zeros(numpy.shape(selected_data), numpy.float) 
     1355        xanchorpos = numpy.zeros(numpy.shape(selected_data), numpy.float) 
     1356        yanchorpos = numpy.zeros(numpy.shape(selected_data), numpy.float) 
    13571357        length = len(attr_indices) 
    13581358 
    13591359        for i in range(length): 
    13601360            if attribute_reverse[i]: 
    1361                 xanchors[i] = selected_data[i] * xanchors[i] + (1-selected_data[i]) * xanchors[(i+1)%length] 
    1362                 yanchors[i] = selected_data[i] * yanchors[i] + (1-selected_data[i]) * yanchors[(i+1)%length] 
     1361                xanchorpos[i] = selected_data[i] * xanchors[i] + (1 - selected_data[i]) * xanchors[(i + 1) % length] 
     1362                yanchorpos[i] = selected_data[i] * yanchors[i] + (1 - selected_data[i]) * yanchors[(i + 1) % length] 
    13631363            else: 
    1364                 xanchors[i] = (1-selected_data[i]) * xanchors[i] + selected_data[i] * xanchors[(i+1)%length] 
    1365                 yanchors[i] = (1-selected_data[i]) * yanchors[i] + selected_data[i] * yanchors[(i+1)%length] 
    1366  
    1367         x_positions = numpy.sum(numpy.multiply(xanchors, selected_data), axis=0)/sum_i 
    1368         y_positions = numpy.sum(numpy.multiply(yanchors, selected_data), axis=0)/sum_i 
    1369         #x_positions = numpy.sum(numpy.transpose(xanchors* numpy.transpose(selectedData)), axis=0) / sum_i 
    1370         #y_positions = numpy.sum(numpy.transpose(yanchors* numpy.transpose(selectedData)), axis=0) / sum_i 
     1364                xanchorpos[i] = (1 - selected_data[i]) * xanchors[i] + selected_data[i] * xanchors[(i + 1) % length] 
     1365                yanchorpos[i] = (1 - selected_data[i]) * yanchors[i] + selected_data[i] * yanchors[(i + 1) % length] 
     1366 
     1367        x_positions = numpy.sum(numpy.multiply(xanchorpos, selected_data), axis=0) / sum_i 
     1368        y_positions = numpy.sum(numpy.multiply(yanchorpos, selected_data), axis=0) / sum_i 
     1369        #x_positions = numpy.sum(numpy.transpose(xanchorpos * numpy.transpose(selectedData)), axis=0) / sum_i 
     1370        #y_positions = numpy.sum(numpy.transpose(yanchorpos * numpy.transpose(selectedData)), axis=0) / sum_i 
    13711371 
    13721372        if scale_factor != 1.0: 
     
    13741374            y_positions = y_positions * scale_factor 
    13751375        if jitter_size > 0.0: 
    1376             x_positions += (numpy.random.random(len(x_positions))-0.5)*jitter_size 
    1377             y_positions += (numpy.random.random(len(y_positions))-0.5)*jitter_size 
     1376            x_positions += (numpy.random.random(len(x_positions)) - 0.5) * jitter_size 
     1377            y_positions += (numpy.random.random(len(y_positions)) - 0.5) * jitter_size 
    13781378 
    13791379        if class_list != None: 
Note: See TracChangeset for help on using the changeset viewer.