Archived
7
0

Fixed drag'n'drop of datasets to DAG-plots to convert inf/-inf to

maximum/minimum values of the dataset.
This commit is contained in:
2007-07-30 14:15:23 +00:00
parent e84a202fbe
commit 0bc4a6e3f0

@ -1,6 +1,6 @@
import gtk import gtk
from fluents import dataset, logger, plots, workflow, fluents, project from fluents import dataset, logger, plots, workflow, fluents, project, view
import geneontology import geneontology
from matplotlib.nxutils import points_inside_poly from matplotlib.nxutils import points_inside_poly
import matplotlib import matplotlib
@ -553,6 +553,7 @@ class DagPlot(plots.Plot):
with_labels=False, name='DAG Plot'): with_labels=False, name='DAG Plot'):
plots.Plot.__init__(self, name) plots.Plot.__init__(self, name)
self._add_ic_spin_button()
self.nodes = graph.nodes() self.nodes = graph.nodes()
self.graph = graph self.graph = graph
self._pos = pos self._pos = pos
@ -617,6 +618,25 @@ class DagPlot(plots.Plot):
self.axes.set_frame_on(False) self.axes.set_frame_on(False)
self.fig.subplots_adjust(left=0, right=1, bottom=0, top=1) self.fig.subplots_adjust(left=0, right=1, bottom=0, top=1)
def _add_ic_spin_button(self):
sb = gtk.SpinButton()
sb.set_range(0, 100)
sb.set_value(1)
sb.set_increments(1, 3)
label = gtk.Label("IC > ")
hbox = gtk.HBox()
hbox.pack_start(label)
hbox.pack_start(sb)
ti = gtk.ToolItem()
ti.set_expand(False)
ti.add(hbox)
sb.show()
label.show()
hbox.show()
ti.show()
self._toolbar.insert(ti, -1)
ti.set_tooltip(self._toolbar.tooltips, "Set information content threshold")
def _calc_pos(self, graph): def _calc_pos(self, graph):
"""Calculates position for graph nodes.""" """Calculates position for graph nodes."""
gv_graph = networkx.DiGraph() gv_graph = networkx.DiGraph()
@ -704,7 +724,13 @@ class DagPlot(plots.Plot):
indices = ds.get_indices(self.current_dim, self.nodes) indices = ds.get_indices(self.current_dim, self.nodes)
nodes = ds.existing_identifiers(self.current_dim, self.nodes) nodes = ds.existing_identifiers(self.current_dim, self.nodes)
v = vec.take(indices, 0) v = vec.take(indices, 0)
vec_min = min(v[v > -inf])
vec_max = max(v[v < inf])
v[v==inf] = vec_max
v[v==-inf] = vec_min
d = dict(zip(nodes, list(v))) d = dict(zip(nodes, list(v)))
map_vec = zeros(len(self.nodes)) map_vec = zeros(len(self.nodes))