Changeset 10130:e66ffef1ad8e in orange


Ignore:
Timestamp:
02/08/12 21:05:25 (2 years ago)
Author:
Miha Stajdohar <miha.stajdohar@…>
Branch:
default
rebase_source:
01fddab4da65026cf8da311bb8e1d3f4723a6a6f
Message:

Refactored.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/testing/regression/tests_20/modules_hclust-iris.py

    r9952 r10130  
    11import orange 
    22import orngClustering 
    3 import pylab 
    4  
    5 def plot_scatter(data, cls, attx, atty, filename="hclust-scatter", title=None): 
    6     """plot a data scatter plot with the position of centeroids""" 
    7     pylab.rcParams.update({'font.size': 8, 'figure.figsize': [4,3]}) 
    8     x = [float(d[attx]) for d in data] 
    9     y = [float(d[atty]) for d in data] 
    10     colors = ["c", "w", "b"] 
    11     cs = "".join([colors[c] for c in cls]) 
    12     pylab.scatter(x, y, c=cs, s=10) 
    13      
    14     pylab.xlabel(attx) 
    15     pylab.ylabel(atty) 
    16     if title: 
    17         pylab.title(title) 
    18     pylab.savefig("%s.png" % filename) 
    19     pylab.close() 
    203 
    214data = orange.ExampleTable("iris") 
     
    236n = 3 
    247cls = orngClustering.hierarhicalClustering_topClustersMembership(root, n) 
    25 plot_scatter(data, cls, "sepal width", "sepal length", title="Hiearchical clustering (%d clusters)" % n) 
Note: See TracChangeset for help on using the changeset viewer.