Esempio n. 1
0
 def drawSVG(self):
     lines = []
     for index in xrange(self.luminoso.npoints):
         if self.luminoso.labels[index].endswith('.txt'): continue
         for sim, amount in self.get_most_similar(index, self.n):
             if sim > index:
                 sx, sy = self.luminoso.screenpts[index]
                 tx, ty = self.luminoso.screenpts[sim]
                 line = svgfig.Line(sx, sy, tx, ty, stroke='black', opacity='0.4')
                 line.attr['stroke-width'] = str(amount)
                 lines.append(line)
     return svgfig.Fig(*lines)
Esempio n. 2
0
 def drawSVG(self):
     return
     lines = []
     for index in xrange(self.luminoso.npoints):
         self.selectEvent(index)
         sx, sy = self.luminoso.screenpts[self.source]
         for target in self.connections:
             if target > self.source:
                 tx, ty = self.luminoso.screenpts[target]
                 line = svgfig.Line(sx, sy, tx, ty, stroke='blue', opacity='0.2')
                 line.attr['stroke-width'] = '0.4'
                 lines.append(line)
     return svgfig.Fig(*lines)
Esempio n. 3
0
 def drawSVG(self):
     circles = []
     pixelsize = self.luminoso.pixel_size()
     for i in xrange(self.luminoso.npoints):
         x, y = self.luminoso.screenpts[i]
         r, g, b = self.luminoso.colors[i]
         mag = max(0.1, self.sizes[i] / pixelsize * 2)
         color = svgfig.rgb(r, g, b, maximum=255.)
         circle = svgfig.Ellipse(x, y, mag, 0, mag, fill=color)
         if self.luminoso.labels[i].endswith('.txt'): continue
         if self.luminoso.labels[i].startswith('#'):
             circle.attr['fill'] = 'white'
             circle.attr['stroke'] = color
             circle.attr['stroke-width'] = '1.5'
         else:
             circle.attr['stroke-width'] = '0.0'
         circles.append(circle)
     return svgfig.Fig(*circles)
Esempio n. 4
0
 def drawSVG(self):
     texts = []
     for i in xrange(self.luminoso.npoints):
         label = self.luminoso.labels[i]
         if label.endswith('.txt'): continue
         bold = False
         x, y = self.luminoso.screenpts[i]
         r, g, b = self.luminoso.colors[i] * 0.5
         pixelsize = self.luminoso.pixel_size()
         mag = max(0.1, self.sizes[i] / pixelsize)
         if ' ' in label: mag *= 2
         if label.startswith('#'):
             label = label[1:]
             bold = True
             mag = 0.000004/pixelsize
         color = svgfig.rgb(r, g, b, maximum=255.)
         text = svgfig.Text(str(x), str(y), label, fill=color)
         text.attr['font-size'] = str(np.sqrt(mag)*10)
         if bold: text.attr['font-weight'] = 'bold'
         texts.append(text)
     return svgfig.Fig(*texts)
Esempio n. 5
0
 def get_svg_figure(self):
     figs = []
     for layer in self.layers:
         fig = layer.drawSVG()
         if fig is not None: figs.append(fig)
     return svgfig.Fig(*figs)