Пример #1
0
    def set_point(self, label, xvalue, yvalue, size, hexcolor, style=7):
        rgb = utils.rgb(hexcolor.strip("#"))

        # make colors darker for hollow points
        # styles: http://jerzak.eu/resources/sandbox/img/gnuplot-ptlt.gif
        if style not in (5, 7, 9, 11, 13, 15):
            rgb = darken_color(rgb)

        color = rgb[0] * 65536 + rgb[1] * 256 + rgb[2]

        self.set_value("x", label, xvalue)
        self.set_value("y", label, yvalue)
        self.set_value("size", label, size)
        self.set_value("color", label, color)
        self.set_value("style", label, style)

        if style not in self.sizes_by_style or \
                self.sizes_by_style[style] < size:
            self.sizes_by_style[style] = size
Пример #2
0
    def prep_bincolors(self):
        if self.bincolors is None:
            self.bincolors = {}

            rgb = utils.rgb(self.fillcolor.strip("#"))
            rgb_interval = (
                (255 - rgb[0]) / self.numcolors,
                (255 - rgb[1]) / self.numcolors,
                (255 - rgb[2]) / self.numcolors,
                )

            for i in range(self.numcolors):
                hexcolor = "#" + utils.triplet(rgb)
                self.bincolors.append(hexcolor)

                rgb = (
                    round(rgb[0] + rgb_interval[0]),
                    round(rgb[1] + rgb_interval[1]),
                    round(rgb[2] + rgb_interval[2]),
                    )