Author: Christopher Hart
Date : April, 2002
These classes provide a framework for visualization within the MLS
python schema. Briefly the work horse of the toolset are two primary
plotting classes IPlot and DatasetPlot built on the BLT toolkit
(although other plotting backend could probably be subsituted) .
IPlot is a specialization of the Pmw.Blt.Graph widget that adds may
user interface enhancements (pull down menus, sortable legends, popup
information, etc).
DatasetPlot is a specialization of IPlot which adds the communication
pathway for the PlotViews framework. A DatasetPlot instance can only
plot when given a PlotView and they communicate via the interface
defined in the IPlotView class. Through this interface custom
PlotViews can be built and combined to allow for a fairly module
interactive and extensible plotting enviroment.
Imported modules
|
|
import MLab
import Numeric
import Pmw
from Scientific.Statistics import Histogram
import Tkinter
import colorsys
from compClust.mlx.datasets import Dataset
from compClust.mlx.labelings import Labeling, GlobalLabeling, GlobalWrapper, subsetByLabeling
from compClust.mlx.views import CachedView, RowAggregateFunctionView, RowPCAView, SortedView, RowSubsetView
from compClust.score import roc, ConfusionMatrix
from compClust.util import DistanceMetrics, Histogram, listOps, unique
from compClust.util.InterpreterTools import safeStdDev
import math
import operator
import re
import sys
import types
|
Functions
|
|
boxPlot
plot
rgbToString
rocPlot
scaleList
startIPlot
|
|
boxPlot
|
boxPlot (
ds,
master=None,
dimension=0,
)
Generate a box plot, dimension = 0 (column-wise) dimension=1 (row-wise)
ds can either be a dataset or an numeric array
|
|
plot
|
plot (
values,
yvalues=None,
xerror=None,
yerror=None,
xmin=None,
xmax=None,
ymin=None,
ymax=None,
plotStyle="line",
color=None,
fileName=None,
seriesName=None,
previousPlot=None,
master=None,
pack=1,
)
A wrapper around the IPlot class to provide a fast easy interface for plotting.
Usage: plot(x,y, <options>)
This creates a plot of the x-vector vs the
y-vector. x and y can be either numeric arrays
r standard python lists plot(y , <options>)
if y is a 1d array/list/tuple it creates a plot of the values vs thier index
if y is a 2d array/list/tuple the values of each row is plotted as a data series vs their index
if y is a dataset, it is treated like a 2d array, only a plotView and a datasetPlotter is returned.
optional Parameters:
plotStyles -> on of the following: line , points , bar
xmin -> float/int
ymin -> float/int
xmax -> float/int
ymax -> float/int
xerror -> NumericArray of len(values)/ if values is a 2d array, xerror should be the same size
yerror -> NumericArray of len(values)/ if values is a 2d array, yerror should be the same size
fileName -> name of postscript file to create
color -> RGB string color (ie #FFFFFF for black ) or [red , blue , green , orange , black , white , 'yellow'].
|
|
rgbToString
|
rgbToString ( rgb )
rgbToString(rgb):
turns an rgb tuple into a hex string
|
|
rocPlot
|
rocPlot (
dataset,
labeling,
label,
distanceMetric=DistanceMetrics.EuclideanDistance,
)
draw our standard ROC plot for the label in labeling for dataset
|
|
scaleList
|
scaleList (
values,
minValue=None,
maxValue=None,
minReturn=0,
maxReturn=1,
)
scaleList(values, minReturn=0, maxReturn=1, minValue=None, maxValue=None)
Given a list of objects, returns a list of values returns a list of
values scalled between 0 and 1 where minValue -> 0 and maxValue ->
1). If values is non-numeric each unique item is mapped arbitrarly
into the 0..1 range. Values must be a list of hashable python
objects
|
|
startIPlot
|
startIPlot ()
Simple Setup function to setup a psedo Tk-application for all widgets to belong to.
|
Classes
|
|
|
|