本文整理汇总了Python中reportlab.graphics.widgets.markers.makeMarker函数的典型用法代码示例。如果您正苦于以下问题:Python makeMarker函数的具体用法?Python makeMarker怎么用?Python makeMarker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeMarker函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sample1c
def sample1c():
"A line plot with non-equidistant points in x-axis."
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.lines[0].symbol = makeMarker('FilledCircle')
lp.lines[1].symbol = makeMarker('Circle')
lp.lineLabelFormat = '%2.0f'
lp.strokeColor = colors.black
lp.xValueAxis.valueMin = 0
lp.xValueAxis.valueMax = 5
lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
lp.xValueAxis.labelTextFormat = '%2.1f'
lp.yValueAxis.valueMin = 0
lp.yValueAxis.valueMax = 7
lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]
drawing.add(lp)
return drawing
示例2: autoLegender
def autoLegender(i, chart, styleObj, sym="symbol"):
if sym:
setattr(styleObj[0], sym, makeMarker("Diamond", size=6))
setattr(styleObj[1], sym, makeMarker("Square"))
width = 300
height = 150
legend = Legend()
legend.x = width - 5
legend.y = 5
legend.dx = 20
legend.dy = 5
legend.deltay = 0
legend.boxAnchor = "se"
if i == "col auto":
legend.colorNamePairs[0] = (Auto(chart=chart), "auto chart=self.chart")
legend.colorNamePairs[1] = (Auto(obj=chart, index=1), "auto chart=self.chart index=1")
elif i == "full auto":
legend.colorNamePairs = Auto(chart=chart)
elif i == "swatch set":
legend.swatchMarker = makeMarker("Circle")
legend.swatchMarker.size = 10
elif i == "swatch auto":
legend.swatchMarker = Auto(chart=chart)
d = Drawing(width, height)
d.background = Rect(0, 0, width, height, strokeWidth=1, strokeColor=colors.red, fillColor=None)
m = makeMarker("Cross")
m.x = width - 5
m.y = 5
m.fillColor = colors.red
m.strokeColor = colors.yellow
d.add(chart)
d.add(legend)
d.add(m)
return d
示例3: demo
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
示例4: autoLegender
def autoLegender(i,chart,styleObj,sym='symbol'):
if sym:
setattr(styleObj[0],sym, makeMarker('Diamond',size=6))
setattr(styleObj[1],sym,makeMarker('Square'))
width = 300
height = 150
legend = Legend()
legend.x = width-5
legend.y = 5
legend.dx = 20
legend.dy = 5
legend.deltay = 0
legend.boxAnchor = 'se'
if i=='col auto':
legend.colorNamePairs[0]=(Auto(chart=chart),'auto chart=self.chart')
legend.colorNamePairs[1]=(Auto(obj=chart,index=1),'auto chart=self.chart index=1')
elif i=='full auto':
legend.colorNamePairs=Auto(chart=chart)
elif i=='swatch set':
legend.swatchMarker=makeMarker('Circle')
legend.swatchMarker.size = 10
elif i=='swatch auto':
legend.swatchMarker=Auto(chart=chart)
d = Drawing(width,height)
d.background = Rect(0,0,width,height,strokeWidth=1,strokeColor=colors.red,fillColor=None)
m = makeMarker('Cross')
m.x = width-5
m.y = 5
m.fillColor = colors.red
m.strokeColor = colors.yellow
d.add(chart)
d.add(legend)
d.add(m)
return d
示例5: _render
def _render(self, drawing):
if not self._labels:
return
gap = 5
lc1 = linecharts.HorizontalLineChart()
lc1.data = [self._data[0]]
lc1.lines.symbol = markers.makeMarker('FilledCircle')
lc1.categoryAxis.categoryNames = self._labels
lc1.lineLabelFormat = '%2.0f'
legend = None
legend_height = 0
if self.kw.get('legendlabels', False):
legend_height = 40
colors_list = []
for i in xrange(len(self._data)):
colors_list.append(lc1.lines[i].strokeColor)
legend = legends.LineLegend()
legend.alignment = 'right'
legend.x = 4 * gap
legend.y = drawing.height - lc1.y - gap
legend.deltay = 60
legend.dxTextSpace = 5
legend.columnMaximum = 1
legend.colorNamePairs = zip(colors_list,
self.kw.get('legendlabels'))
lc1.x = 20
lc1.y = 20
lc1.height = self.height - lc1.y - legend_height
lc1.width = self.width - 1.5 * lc1.x
lc1.lineLabels.dx = -7
lc1.lineLabels.fillColor = colors.red
lc2 = linecharts.HorizontalLineChart()
lc2.data = [self._data[1]]
lc2.lines.symbol = markers.makeMarker('FilledCircle')
lc2.categoryAxis.categoryNames = self._labels
lc2.lineLabelFormat = '%2.0f'
lc2.lineLabels.dx = 7
lc2.lineLabels.fillColor = colors.green
lc2.valueAxis.strokeColor = colors.green
# lc2.valueAxis
lc2.categoryAxis.visible = False
lc2.x = 20
lc2.y = 20
lc2.height = self.height - lc2.y - legend_height
lc2.width = self.width - 1.5 * lc1.x
lc2.valueAxis.joinAxisMode = 'right'
lc2.lines[0].strokeColor = colors.green
drawing.add(lc1)
drawing.add(lc2)
if legend:
drawing.add(legend, 'legend')
示例6: sample3
def sample3():
drawing = Drawing(400, 200)
data = [
(13, 5, 20, 22, 37, 45, 19, 4),
(5, 20, 46, 38, 23, 21, 6, 14)
]
lc = HorizontalLineChart()
lc.x = 50
lc.y = 50
lc.height = 125
lc.width = 300
lc.data = data
lc.joinedLines = 1
lc.lineLabelFormat = '%2.0f'
lc.strokeColor = colors.black
lc.lines[0].symbol = makeMarker('Smiley')
lc.lines[1].symbol = NoEntry
lc.lines[0].strokeWidth = 2
lc.lines[1].strokeWidth = 4
catNames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ')
lc.categoryAxis.categoryNames = catNames
lc.categoryAxis.labels.boxAnchor = 'n'
lc.valueAxis.valueMin = 0
lc.valueAxis.valueMax = 60
lc.valueAxis.valueStep = 15
drawing.add(lc)
return drawing
示例7: sample2
def sample2():
"A line plot with non-equidistant points in x-axis."
drawing = Drawing(400, 200)
data = [
(
("25/11/1991", 1),
("30/11/1991", 1.000933333),
("31/12/1991", 1.0062),
("31/01/1992", 1.0112),
("29/02/1992", 1.0158),
("31/03/1992", 1.020733333),
("30/04/1992", 1.026133333),
("31/05/1992", 1.030266667),
("30/06/1992", 1.034466667),
("31/07/1992", 1.038733333),
("31/08/1992", 1.0422),
("30/09/1992", 1.045533333),
("31/10/1992", 1.049866667),
("30/11/1992", 1.054733333),
("31/12/1992", 1.061),
)
]
data[0] = preprocessData(data[0])
lp = LinePlot()
lp.x = 50
lp.y = 50
lp.height = 125
lp.width = 300
lp.data = data
lp.joinedLines = 1
lp.lines.symbol = makeMarker("FilledDiamond")
lp.strokeColor = colors.black
start = mktime(mkTimeTuple("25/11/1991"))
t0 = mktime(mkTimeTuple("30/11/1991"))
t1 = mktime(mkTimeTuple("31/12/1991"))
t2 = mktime(mkTimeTuple("31/03/1992"))
t3 = mktime(mkTimeTuple("30/06/1992"))
t4 = mktime(mkTimeTuple("30/09/1992"))
end = mktime(mkTimeTuple("31/12/1992"))
lp.xValueAxis.valueMin = start
lp.xValueAxis.valueMax = end
lp.xValueAxis.valueSteps = [start, t0, t1, t2, t3, t4, end]
lp.xValueAxis.labelTextFormat = seconds2str
lp.xValueAxis.labels[1].dy = -20
lp.xValueAxis.labels[2].dy = -35
lp.yValueAxis.labelTextFormat = "%4.2f"
lp.yValueAxis.valueMin = 100
lp.yValueAxis.valueMax = 110
lp.yValueAxis.valueStep = 2
drawing.add(lp)
return drawing
示例8: sample1a
def sample1a():
"A line plot with non-equidistant points in x-axis."
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.strokeColor = colors.black
lp.lines.symbol = makeMarker("UK_Flag")
lp.lines[0].strokeWidth = 2
lp.lines[1].strokeWidth = 4
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
示例9: sample2
def sample2():
drawing = Drawing(400, 200)
data = [(13, 5, 20, 22, 37, 45, 19, 4), (5, 20, 46, 38, 23, 21, 6, 14)]
lc = HorizontalLineChart()
lc.x = 50
lc.y = 50
lc.height = 125
lc.width = 300
lc.data = data
lc.joinedLines = 1
lc.lines.symbol = makeMarker("Smiley")
lc.lineLabelFormat = "%2.0f"
lc.strokeColor = colors.black
lc.fillColor = colors.lightblue
catNames = "Jan Feb Mar Apr May Jun Jul Aug".split(" ")
lc.categoryAxis.categoryNames = catNames
lc.categoryAxis.labels.boxAnchor = "n"
lc.valueAxis.valueMin = 0
lc.valueAxis.valueMax = 60
lc.valueAxis.valueStep = 15
drawing.add(lc)
return drawing
示例10: line_plot
def line_plot(O, xy_max, data, label_font_size):
if (reportlab is None): return
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.graphics.widgets.markers import makeMarker
from reportlab.lib import colors
lp = LinePlot()
lp.x = 40
lp.y = 40
lp.height = 120
lp.width = 120
lp.data = [[(0,0),(xy_max,xy_max)], data]
lp.lines[0].strokeColor = colors.Color(*[0.8]*3)
lp.lines[0].strokeWidth = 0.5
lp.lines[1].strokeColor = colors.white
lp.lines[1].strokeWidth = 0
lp.lines[1].symbol = makeMarker("Circle")
lp.lines[1].symbol.strokeWidth = 0.5
lp.joinedLines = 1
lp.strokeColor = colors.Color(*[0.8]*3)
lp.strokeWidth = 1
lp.xValueAxis.valueMin = 0
lp.xValueAxis.valueMax = xy_max
lp.xValueAxis.valueSteps = range(xy_max+1)
lp.xValueAxis.strokeWidth = 1
lp.xValueAxis.tickDown = 3
lp.xValueAxis.labels.fontSize = label_font_size
lp.yValueAxis.valueMin = 0
lp.yValueAxis.valueMax = xy_max
lp.yValueAxis.valueSteps = range(xy_max+1)
lp.yValueAxis.strokeWidth = 1
lp.yValueAxis.tickLeft = 3
lp.yValueAxis.labels.fontSize = label_font_size
return lp
示例11: sample1a
def sample1a():
drawing = Drawing(400, 200)
data = [
(13, 5, 20, 22, 37, 45, 19, 4),
(5, 20, 46, 38, 23, 21, 6, 14)
]
lc = SampleHorizontalLineChart()
lc.x = 50
lc.y = 50
lc.height = 125
lc.width = 300
lc.data = data
lc.joinedLines = 1
lc.strokeColor = colors.white
lc.fillColor = colors.HexColor(0xCCCCCC)
lc.lines.symbol = makeMarker('FilledDiamond')
lc.lineLabelFormat = '%2.0f'
catNames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ')
lc.categoryAxis.categoryNames = catNames
lc.categoryAxis.labels.boxAnchor = 'n'
lc.valueAxis.valueMin = 0
lc.valueAxis.valueMax = 60
lc.valueAxis.valueStep = 15
drawing.add(lc)
return drawing
示例12: sample2
def sample2():
"Make a spider chart with markers, but no fill"
d = Drawing(400, 400)
sp = SpiderChart()
sp.x = 50
sp.y = 50
sp.width = 300
sp.height = 300
sp.data = [[10,12,14,16,14,12], [6,8,10,12,9,15],[7,8,17,4,12,8]]
sp.labels = ['U','V','W','X','Y','Z']
sp.strands.strokeWidth = 1
sp.strands[0].fillColor = colors.pink
sp.strands[1].fillColor = colors.lightblue
sp.strands[2].fillColor = colors.palegreen
sp.strands[0].strokeColor = colors.red
sp.strands[1].strokeColor = colors.blue
sp.strands[2].strokeColor = colors.green
sp.strands.symbol = "FilledDiamond"
sp.strands[1].symbol = makeMarker("Circle")
sp.strands[1].symbol.strokeWidth = 0.5
sp.strands[1].symbol.fillColor = colors.yellow
sp.strands.symbolSize = 6
sp.strandLabels[0,3]._text = 'special'
sp.strandLabels[0,1]._text = 'one'
sp.strandLabels[0,0]._text = 'zero'
sp.strandLabels[1,0]._text = 'Earth'
sp.strandLabels[2,2]._text = 'Mars'
sp.strandLabels.format = 'values'
sp.strandLabels.dR = -5
d.add(sp)
return d
示例13: line_plot
def line_plot(data, elements):
drawing = Drawing(0, 400) # for indices
lp = LinePlot()
lp.x = 0
lp.y = 50
lp.height = 300
lp.width = 600
lp.data = data
lp.joinedLines = 1
lp.lines[0].symbol = makeMarker('FilledCircle')
lp.lines[1].symbol = makeMarker('Circle')
lp.lineLabelFormat = '%2.0f'
lp.strokeColor = colors.black
lp.xValueAxis.valueMin = 0
lp.xValueAxis.valueMax = 5
lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
lp.xValueAxis.labelTextFormat = '%2.1f'
lp.yValueAxis.valueMin = 0
lp.yValueAxis.valueMax = 7
lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]
drawing.add(lp)
elements.append(drawing)
示例14: __init__
def __init__(self, chart, data_dict, width=600, height=450,
colorscheme='color'):
""" Initialize the basic graphing class.
Set the chart, data, width, height and color scheme.
"""
self._data_dict = data_dict
Drawing.__init__(self, width, height)
self.add(chart, name='_linechart')
self._linechart.width = 900
self._linechart.height = 240
self._linechart.x = 50
self._linechart.y = 80
self._linechart.joinedLines = 1
self._linechart.categoryAxis.categoryNames = self.getCategories()
self._linechart.categoryAxis.labels.boxAnchor = 'n'
self._linechart.valueAxis.valueMin = 0
self._linechart.valueAxis.valueMax = self.getHighestScore()
self._linechart.valueAxis.valueStep = 1
self._linechart.lines[0].strokeWidth = 2
self._linechart.lines[1].strokeWidth = 1.5
self._linechart.lines[0].strokeDashArray=3,4
self._linechart.lines[0].strokeColor = colors.green
self._linechart.lines[1].strokeColor = colors.red
self._linechart.lines[1].symbol = makeMarker('Cross')
self._linechart.lines[0].symbol = makeMarker('Cross')
# calculate a sane y-axis interval
valuestep = self.getHighestScore() / 10
if valuestep <= 1:
self._linechart.valueAxis.valueStep = 1
else:
self._linechart.valueAxis.valueStep = valuestep
self.setTitle()
self._linechart.data = self.getChartData()
示例15: line_chart_draw
def line_chart_draw(self, values, days):
nr_days = len(days)
min_temp = min(min(values[0]), min(values[1]))
d = Drawing(0, 170)
# draw line chart
chart = SampleHorizontalLineChart()
# set width and height
chart.width = 350
chart.height = 135
# set data values
chart.data = values
# use(True) or not(False) line between points
chart.joinedLines = True
# set font desired
chart.lineLabels.fontName = 'FreeSans'
# set color for the plot area border and interior area
chart.strokeColor = colors.white
chart.fillColor = colors.lightblue
# set lines color and width
chart.lines[0].strokeColor = colors.red
chart.lines[0].strokeWidth = 2
chart.lines[1].strokeColor = colors.blue
chart.lines[1].strokeWidth = 2
# set symbol for points
chart.lines.symbol = makeMarker('Square')
# set format for points from chart
chart.lineLabelFormat = '%2.0f'
# for negative axes intersect should be under zero
chart.categoryAxis.joinAxisMode = 'bottom'
# set font used for axes
chart.categoryAxis.labels.fontName = 'FreeSans'
if nr_days > 7:
chart.categoryAxis.labels.angle = 45
chart.categoryAxis.labels.boxAnchor = 'e'
chart.categoryAxis.categoryNames = days
# change y axe format
chart.valueAxis.labelTextFormat = '%2.0f °C'
chart.valueAxis.valueStep = 10
if min_temp > 0:
chart.valueAxis.valueMin = 0
llabels = ['Max temp', 'Min temp']
d.add(self.title_draw(250, 180, _('Temperatures statistics')))
d.add(chart)
d.add(self.legend_draw(llabels, chart, x=400, y=150, type='line'))
return d