Example #1
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)
Example #2
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)