Example #1
0
 def draw_crossings(self):
     "Draw crossings of a phidelta diagram"
     left, top, right, bottom = multiple_get(self.borders, self.border_keys)
     X, Y = zip(left, right)
     self.axes.plot(X, Y, color='0.5', linestyle='dashed', zorder=1)
     X, Y = zip(top, bottom)
     self.axes.plot(X, Y, color='0.5', linestyle='dashed', zorder=1)
Example #2
0
 def draw_crossings(self,ax):
   "Draws crossings for a rhombus"
   left, top, right, bottom = multiple_get(self.borders,self.border_keys)
   X, Y = zip(left,right)
   ax.plot ( X, Y, color='0.5', linestyle='dashed', zorder=1 )
   X, Y = zip(top,bottom)
   ax.plot ( X, Y, color='0.5', linestyle='dashed', zorder=1 )
Example #3
0
 def load_dataset(self, info):
     "Load a dataset (file information given as dataset object)"
     keys = 'filename', 'classes', 'sep', 'index', 'header'
     filename, classes, sep, index, header = multiple_get(
         info.__dict__, keys)
     fnames, check = None, info.check_class
     content = self.load_content(filename)
     if header: fnames, content = content[0], content[1:]
     data = np.array([string_split(ln, sep) for ln in content], dtype=str)
     labels = np.array([1 if check(c) else -1 for c in data[:, index]])
     data = np.delete(data, index, 1)
     nrows, ncols = data.shape
     assert len(data) > 0, "Failure while loading file {}".format(filename)
     info.fnames = self.parse_fnames(fnames,
                                     ncols=ncols,
                                     sep=sep,
                                     index=index)
     return data, labels, info
Example #4
0
 def fill(self,ax,color='lightgrey'):
   "Fill the background of a phidelta diagram"
   X, Y = unzip2(multiple_get(self.borders,self.border_keys))
   ax.fill ( X + X[:1], Y + Y[:1], color=color, zorder=0 )
Example #5
0
 def draw_borders(self, ax):
   "Draws borders of a rhombus"
   X, Y = unzip2(multiple_get(self.borders,self.border_keys))
   ax.plot ( X + X[:1], Y + Y[:1], color='r', zorder=1 )
Example #6
0
 def draw_axes(self, ax):
   "Draws axes of a rhombus"
   xmin, ymax, xmax, ymin = multiple_get(self.limits,self.limit_keys)
   ax.plot([0.,0.],[-1.,1.], color = 'b', zorder=1)
   ax.plot([xmin,xmax],[0.,0.], color = 'b', zorder=1)
Example #7
0
 def set_limits(self, ax, projection = '2d'):
   "Sets limits of a rhombus"
   xmin, ymax, xmax, ymin = multiple_get(self.limits,self.limit_keys)
   ax.set_xlim(xmin, xmax) ; ax.set_ylim(ymin, ymax)
Example #8
0
 def fill(self, size=160):
     "Fill the background of a phidelta diagram"
     X, Y = unzip2(multiple_get(self.borders, self.border_keys))
     self.axes.fill(X + X[:1], Y + Y[:1], color='lightgrey', zorder=0)
Example #9
0
 def draw_borders(self):
     "Draw borders of a phidelta diagram"
     X, Y = unzip2(multiple_get(self.borders, self.border_keys))
     self.axes.plot(X + X[:1], Y + Y[:1], color='r', zorder=1)
Example #10
0
 def draw_axes(self):
     "Draw axes of a phidelta diagram"
     xmin, ymax, xmax, ymin = multiple_get(self.limits, self.limit_keys)
     self.axes.plot([0., 0.], [-1., 1.], color='b', zorder=1)
     self.axes.plot([xmin, xmax], [0., 0.], color='b', zorder=1)
Example #11
0
 def set_limits(self):
     "Set limits of a phidelta diagram"
     xmin, ymax, xmax, ymin = multiple_get(self.limits, self.limit_keys)
     self.axes.set_xlim(xmin, xmax)
     self.axes.set_ylim(ymin, ymax)