Python reportlab.lib.colors.black() Examples
The following are 30
code examples of reportlab.lib.colors.black().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
reportlab.lib.colors
, or try the search function
.
Example #1
Source File: report.py From flask-restful-example with MIT License | 10 votes |
def table_model(): """ 添加表格 :return: """ template_path = current_app.config.get("REPORT_TEMPLATES") image_path = os.path.join(template_path, 'test.jpg') new_img = Image(image_path, width=300, height=300) base = [ [new_img, ""], ["大类", "小类"], ["WebFramework", "django"], ["", "flask"], ["", "web.py"], ["", "tornado"], ["Office", "xlsxwriter"], ["", "openpyxl"], ["", "xlrd"], ["", "xlwt"], ["", "python-docx"], ["", "docxtpl"], ] style = [ # 设置字体 ('FONTNAME', (0, 0), (-1, -1), 'SimSun'), # 合并单元格 (列,行) ('SPAN', (0, 0), (1, 0)), ('SPAN', (0, 2), (0, 5)), ('SPAN', (0, 6), (0, 11)), # 单元格背景 ('BACKGROUND', (0, 1), (1, 1), HexColor('#548DD4')), # 字体颜色 ('TEXTCOLOR', (0, 1), (1, 1), colors.white), # 对齐设置 ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('ALIGN', (0, 0), (-1, -1), 'CENTER'), # 单元格框线 ('GRID', (0, 0), (-1, -1), 0.5, colors.grey), ('BOX', (0, 0), (-1, -1), 0.5, colors.black), ] component_table = Table(base, style=style) return component_table
Example #2
Source File: report.py From nanopype with MIT License | 6 votes |
def add_section_sequences(self, plots=[], stats=None): section = self.get_section_number() subsection = itertools.count(1) if stats is not None: self.story.append(Paragraph("{:d} Basecalling".format(section), self.heading_style)) self.story.append(Spacer(1, 0)) self.story.append(Paragraph("{:d}.{:d} Summary".format(section, next(subsection)), self.heading2_style)) #['Tag', 'Basecalling', 'Sum', 'Mean', 'Median', 'N50', 'Maximum'] header = ['', ''] + list(stats.columns.values[2:]) table_data = [header] + [[y if isinstance(y, str) else '{:.0f}'.format(y) for y in x] for x in stats.values] table_style = [ ('FONTSIZE', (0,0), (-1, -1), 10), ('LINEABOVE', (0,1), (-1,1), 0.5, colors.black), ('LINEBEFORE', (2,0), (2,-1), 0.5, colors.black), ('ALIGN', (0,0), (1,-1), 'LEFT'), ('ALIGN', (2,0), (-1,-1), 'RIGHT')] self.story.append(Table(table_data, style=table_style)) self.story.append(Spacer(1, 0)) for key, group in itertools.groupby(plots, lambda x : x[1].basecalling): self.story.append(Paragraph('{:d}.{:d} {}:'.format(section, next(subsection), key.capitalize()), self.heading2_style)) for plot_file, plot_wildcards in sorted(list(group), key=lambda x : x[1].i): im = svg2rlg(plot_file) im = Image(im, width=im.width * self.plot_scale, height=im.height * self.plot_scale) im.hAlign = 'CENTER' self.story.append(im) self.story.append(Spacer(1, 0)) self.story.append(Spacer(1, 0.5*cm))
Example #3
Source File: legends.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def demo(self): "Make sample legend." d = Drawing(200, 100) legend = Legend() legend.alignment = 'left' legend.x = 0 legend.y = 100 legend.dxTextSpace = 5 items = 'red green blue yellow pink black white'.split() items = [(getattr(colors, i), i) for i in items] legend.colorNamePairs = items d.add(legend, 'legend') return d
Example #4
Source File: legends.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def sample1c(): "Make sample legend." d = Drawing(200, 100) legend = Legend() legend.alignment = 'right' legend.x = 0 legend.y = 100 legend.dxTextSpace = 5 items = 'red green blue yellow pink black white'.split() items = [(getattr(colors, i), i) for i in items] legend.colorNamePairs = items d.add(legend, 'legend') return d
Example #5
Source File: legends.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def sample2c(): "Make sample legend." d = Drawing(200, 100) legend = Legend() legend.alignment = 'right' legend.x = 20 legend.y = 90 legend.deltax = 60 legend.dxTextSpace = 10 legend.columnMaximum = 4 items = 'red green blue yellow pink black white'.split() items = [(getattr(colors, i), i) for i in items] legend.colorNamePairs = items d.add(legend, 'legend') return d
Example #6
Source File: legends.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def sample3(): "Make sample legend with line swatches." d = Drawing(200, 100) legend = LineLegend() legend.alignment = 'right' legend.x = 20 legend.y = 90 legend.deltax = 60 legend.dxTextSpace = 10 legend.columnMaximum = 4 items = 'red green blue yellow pink black white'.split() items = [(getattr(colors, i), i) for i in items] legend.colorNamePairs = items d.add(legend, 'legend') return d
Example #7
Source File: legends.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def sample3a(): "Make sample legend with line swatches and dasharrays on the lines." d = Drawing(200, 100) legend = LineLegend() legend.alignment = 'right' legend.x = 20 legend.y = 90 legend.deltax = 60 legend.dxTextSpace = 10 legend.columnMaximum = 4 items = 'red green blue yellow pink black white'.split() darrays = ([2,1], [2,5], [2,2,5,5], [1,2,3,4], [4,2,3,4], [1,2,3,4,5,6], [1]) cnp = [] for i in range(0, len(items)): l = LineSwatch() l.strokeColor = getattr(colors, items[i]) l.strokeDashArray = darrays[i] cnp.append((l, items[i])) legend.colorNamePairs = cnp d.add(legend, 'legend') return d
Example #8
Source File: base.py From testplan with Apache License 2.0 | 6 votes |
def get_row_data(self, source, depth, row_idx): """ Load the Matplotlib graph from the saved image, set its height and width and add it to the row. """ header = self.get_header(source, depth, row_idx) styles = [ RowStyle( font=(constants.FONT, constants.FONT_SIZE_SMALL), left_padding=constants.INDENT * (depth + 1), text_color=colors.black, ) ] img = Image(source["source_path"]) img.drawWidth = source["width"] * inch img.drawHeight = source["height"] * inch return header + RowData( content=[img, "", "", ""], start=header.end, style=styles )
Example #9
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def sampleH5a(): "A simple bar chart with no expressed spacing attributes." drawing = Drawing(400, 200) data = dataSample5 bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing
Example #10
Source File: flags.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def demo(self): D = Drawing(200, 100) name = self.availableFlagNames() import time name = name[int(time.time()) % len(name)] fx = Flag() fx.kind = name fx.x = 0 fx.y = 0 D.add(fx) labelFontSize = 10 D.add(String(fx.x+(fx.size/2.0),(fx.y-(1.2*labelFontSize)), name, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) labelFontSize = int(fx.size/4.0) D.add(String(fx.x+(fx.size),(fx.y+((fx.size/2.0))), "SAMPLE", fillColor=colors.gold, textAnchor='middle', fontSize=labelFontSize, fontName="Helvetica-Bold")) return D
Example #11
Source File: flags.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def _Flag_Belgium(self): s = _size g = Group() box = Rect(0, 0, s*2, s, fillColor = colors.black, strokeColor = colors.black, strokeWidth=0) g.add(box) box1 = Rect(0, 0, width=(s/3.0)*2.0, height=s, fillColor = colors.black, strokeColor = None, strokeWidth=0) g.add(box1) box2 = Rect(((s/3.0)*2.0), 0, width=(s/3.0)*2.0, height=s, fillColor = colors.gold, strokeColor = None, strokeWidth=0) g.add(box2) box3 = Rect(((s/3.0)*4.0), 0, width=(s/3.0)*2.0, height=s, fillColor = colors.red, strokeColor = None, strokeWidth=0) g.add(box3) return g
Example #12
Source File: flags.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def _Flag_Austria(self): s = _size # abbreviate as we will use this a lot g = Group() box = Rect(0, 0, s*2, s, fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0) g.add(box) redbox1 = Rect(0, 0, width=s*2.0, height=s/3.0, fillColor = colors.red, strokeColor = None, strokeWidth=0) g.add(redbox1) redbox2 = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0, fillColor = colors.red, strokeColor = None, strokeWidth=0) g.add(redbox2) return g
Example #13
Source File: flags.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def _Flag_Afghanistan(self): s = _size g = Group() box = Rect(0, 0, s*2, s, fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0) g.add(box) greenbox = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0, fillColor = colors.limegreen, strokeColor = None, strokeWidth=0) g.add(greenbox) blackbox = Rect(0, 0, width=s*2.0, height=s/3.0, fillColor = colors.black, strokeColor = None, strokeWidth=0) g.add(blackbox) return g
Example #14
Source File: lineplots.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def demo(self): """Shows basic use of a line chart.""" drawing = Drawing(400, 200) data = [ ((1,1), (2,2), (2.5,1), (3,3), (4,5)), ((1,2), (2,3), (2.5,2), (3.5,5), (4,6)) ] lp = LinePlot() lp.x = 50 lp.y = 50 lp.height = 125 lp.width = 300 lp.data = data lp.joinedLines = 1 lp.lineLabelFormat = '%2.0f' lp.strokeColor = colors.black lp.lines[0].strokeColor = colors.red lp.lines[0].symbol = makeMarker('FilledCircle') lp.lines[1].strokeColor = colors.blue lp.lines[1].symbol = makeMarker('FilledDiamond') lp.xValueAxis.valueMin = 0 lp.xValueAxis.valueMax = 5 lp.xValueAxis.valueStep = 1 lp.yValueAxis.valueMin = 0 lp.yValueAxis.valueMax = 7 lp.yValueAxis.valueStep = 1 drawing.add(lp) return drawing
Example #15
Source File: flags.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def _Flag_None(self): s = _size # abbreviate as we will use this a lot g = Group() g.add(Rect(0, 0, s*2, s, fillColor = colors.purple, strokeColor = colors.black, strokeWidth=0)) return g
Example #16
Source File: signsandsymbols.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.strokeColor = colors.black self.fillColor = colors.gold self.strokeWidth = self.size*0.125
Example #17
Source File: signsandsymbols.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.strokeColor = colors.black self.fillColor = colors.orangered self.innerBarColor = colors.ghostwhite
Example #18
Source File: signsandsymbols.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.strokeColor = colors.black self.fillColor = colors.orangered self.stopColor = colors.ghostwhite
Example #19
Source File: table.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __init__(self, x=10, y=10, **kw): self.x = x self.y = y self.width = 200 self.height = 100 self.borderStrokeColor = colors.black self.fillColor = None self.borderStrokeWidth = 0.5 self.horizontalDividerStrokeColor = colors.black self.verticalDividerStrokeColor = colors.black self.horizontalDividerStrokeWidth = 0.5 self.verticalDividerStrokeWidth = 0.25 self.dividerDashArray = None self.data = [['North','South','East','West'],[100,110,120,130],['A','B','C','D']] # list of rows each row is a list of columns self.boxAnchor = 'nw' #self.fontName = None self.fontSize = 8 self.fontColor = colors.black self.alignment = 'right' self.textAnchor = 'start' for k, v in kw.items(): if k in list(self.__class__._attrMap.keys()): setattr(self, k, v) else: raise ValueError('invalid argument supplied for class %s'%self.__class__)
Example #20
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH0b(): "Make a pathologic bar chart with only ONE data item." drawing = Drawing(400, 200) data = [(42,)] bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 50 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'se' bc.categoryAxis.labels.angle = 30 bc.categoryAxis.categoryNames = ['Jan-99'] drawing.add(bc) return drawing
Example #21
Source File: flags.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def _Flag_Cuba(self): s = _size g = Group() for i in range(5): stripe = Rect(0, i*s/5.0, width=s*2, height=s/5.0, fillColor = [colors.darkblue, colors.mintcream][i%2], strokeColor = None, strokeWidth=0) g.add(stripe) redwedge = Polygon(points = [ 0, 0, 4*s/5.0, (s/2.0), 0, s], fillColor = colors.red, strokeColor = None, strokeWidth=0) g.add(redwedge) star = Star() star.x = 2.5*s/10.0 star.y = s/2.0 star.size = 3*s/10.0 star.fillColor = colors.white g.add(star) box = Rect(0, 0, s*2, s, fillColor = None, strokeColor = colors.black, strokeWidth=0) g.add(box) return g
Example #22
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH1(): "Sample of multi-series bar chart." drawing = Drawing(400, 200) data = [ (13, 5, 20, 22, 37, 45, 19, 4), (14, 6, 21, 23, 38, 46, 20, 5) ] bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' catNames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ') catNames = [n+'-99' for n in catNames] bc.categoryAxis.categoryNames = catNames drawing.add(bc, 'barchart') return drawing
Example #23
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH5c4(): "Simple bar chart with absolute spacing." drawing = Drawing(400, 200) data = dataSample5 bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.useAbsolute = 1 bc.barWidth = 10 bc.groupSpacing = 20 bc.barSpacing = 10 bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing
Example #24
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH5c3(): "Simple bar chart with absolute spacing." drawing = Drawing(400, 200) data = dataSample5 bc = HorizontalBarChart() bc.x = 50 bc.y = 20 bc.height = 155 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.useAbsolute = 1 bc.barWidth = 10 bc.groupSpacing = 0 bc.barSpacing = 2 bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing
Example #25
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH5c2(): "Simple bar chart with absolute spacing." drawing = Drawing(400, 200) data = dataSample5 bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.useAbsolute = 1 bc.barWidth = 10 bc.groupSpacing = 20 bc.barSpacing = 0 bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing
Example #26
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH5b(): "A simple bar chart with proportional spacing." drawing = Drawing(400, 200) data = dataSample5 bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.useAbsolute = 0 bc.barWidth = 40 bc.groupSpacing = 20 bc.barSpacing = 10 bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing
Example #27
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH0c(): "Make a really pathologic bar chart with NO data items at all!" drawing = Drawing(400, 200) data = [()] bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'se' bc.categoryAxis.labels.angle = 30 bc.categoryAxis.categoryNames = [] drawing.add(bc) return drawing
Example #28
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH4d(): "A bar chart showing value axis region entirely *below* zero." drawing = Drawing(400, 200) data = [(-13, -20)] bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = -30 bc.valueAxis.valueMax = -10 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing
Example #29
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH4c(): "A bar chart showing value axis region starting *above* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 10 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing
Example #30
Source File: barcharts.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def sampleH4b(): "A bar chart showing value axis region starting *below* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = HorizontalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = -10 bc.valueAxis.valueMax = 60 bc.valueAxis.valueStep = 15 bc.categoryAxis.labels.boxAnchor = 'e' bc.categoryAxis.categoryNames = ['Ying', 'Yang'] drawing.add(bc) return drawing