本文整理汇总了Python中pygal.XY类的典型用法代码示例。如果您正苦于以下问题:Python XY类的具体用法?Python XY怎么用?Python XY使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XY类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_secondary_xy
def test_secondary_xy():
chart = XY()
chart.add(10 * '1', [(30, 5), (20, 12), (25, 4)])
chart.add(10 * '1b', [(4, 12), (5, 8), (6, 4)], secondary=True)
chart.add(10 * '2b', [(3, 24), (0, 17), (12, 9)], secondary=True)
chart.add(10 * '2', [(8, 23), (21, 1), (5, 0)])
return chart.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:7,代码来源:tests.py
示例2: test_xy_links
def test_xy_links():
xy = XY(style=styles['neon'], interpolate='cubic')
xy.add(
'1234', [{
'value': (10, 5),
'label': 'Ten',
'xlink': 'http://google.com?q=10'
}, {
'value': (20, 20),
'tooltip': 'Twenty',
'xlink': 'http://google.com?q=20'
}, (30, 15), {
'value': (40, -5),
'label': 'Forty',
'xlink': 'http://google.com?q=40'
}]
)
xy.add(
'4321', [(40, 10), {
'value': (30, 3),
'label': 'Thirty',
'xlink': 'http://google.com?q=30'
}, (20, 10), (10, 21)]
)
xy.x_labels = list(range(1, 50))
xy.y_labels = list(range(1, 50))
return xy.render_response()
开发者ID:Kozea,项目名称:pygal,代码行数:28,代码来源:tests.py
示例3: test_xy_links
def test_xy_links():
xy = XY(style=styles["neon"], interpolate="cubic")
xy.add(
"1234",
[
{"value": (10, 5), "label": "Ten", "xlink": "http://google.com?q=10"},
{"value": (20, 20), "tooltip": "Twenty", "xlink": "http://google.com?q=20"},
(30, 15),
{"value": (40, -5), "label": "Forty", "xlink": "http://google.com?q=40"},
],
)
xy.add(
"4321",
[(40, 10), {"value": (30, 3), "label": "Thirty", "xlink": "http://google.com?q=30"}, (20, 10), (10, 21)],
)
xy.x_labels = list(range(1, 50))
xy.y_labels = list(range(1, 50))
return xy.render_response()
开发者ID:rnjdeltaYoda,项目名称:pygal,代码行数:19,代码来源:tests.py
示例4: test_fill_with_none
def test_fill_with_none():
graph = XY(fill=True)
graph.add('1', [(1, 2), (3, 3), (3.5, 5), (5, 1)])
graph.add('2', [(1, 9), (None, 5), (5, 23)])
return graph.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:5,代码来源:tests.py
示例5: test_xy_single
def test_xy_single():
graph = XY(interpolate='cubic')
graph.add('Single', [(1, 1)])
return graph.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:4,代码来源:tests.py
示例6: range
for m in range(n + 1):
if m == k:
continue
p *= sin(0.5 * (X - x[m])) / sin(0.5 * (x[k] - x[m]))
s += y[k] * p
yield X, s
"""
These functions takes two lists of points x and y and
returns an iterator over the interpolation between all these points
with `precision` interpolated points between each of them
"""
INTERPOLATIONS = {
'quadratic': quadratic_interpolate,
'cubic': cubic_interpolate,
'hermite': hermite_interpolate,
'lagrange': lagrange_interpolate,
'trigonometric': trigonometric_interpolate
}
if __name__ == '__main__':
from pygal import XY
points = [(.1, 7), (.3, -4), (.6, 10), (.9, 8), (1.4, 3), (1.7, 1)]
xy = XY(show_dots=False)
xy.add('normal', points)
xy.add('quadratic', quadratic_interpolate(*zip(*points)))
xy.add('cubic', cubic_interpolate(*zip(*points)))
xy.render_in_browser()
开发者ID:Bouska,项目名称:pygal,代码行数:30,代码来源:interpolate.py
示例7: test_secondary_xy
def test_secondary_xy():
chart = XY()
chart.add(10 * '1', [(30, 5), (20, 12), (25, 4)])
chart.add(10 * '1b', [(4, 12), (5, 8), (6, 4)], secondary=True)
chart.add(10 * '2b', [(3, 24), (0, 17), (12, 9)], secondary=True)
chart.add(10 * '2', [(8, 23), (21, 1), (5, 0)])
chart.value_formatter = lambda x: str(int(x)) + '+'
return chart.render_response()
开发者ID:Kozea,项目名称:pygal,代码行数:8,代码来源:tests.py
示例8: XY
s += y[k] * p
yield X, s
INTERPOLATIONS = {
'quadratic': quadratic_interpolate,
'cubic': cubic_interpolate,
'hermite': hermite_interpolate,
'lagrange': lagrange_interpolate,
'trigonometric': trigonometric_interpolate
}
if __name__ == '__main__':
from pygal import XY
points = [(.1, 7), (.3, -4), (.6, 10), (.9, 8), (1.4, 3), (1.7, 1)]
xy = XY(show_dots=False)
xy.add('normal', points)
xy.add('quadratic', quadratic_interpolate(*zip(*points)))
xy.add('cubic', cubic_interpolate(*zip(*points)))
xy.add('lagrange', lagrange_interpolate(*zip(*points)))
xy.add('trigonometric', trigonometric_interpolate(*zip(*points)))
xy.add('hermite catmul_rom', hermite_interpolate(
*zip(*points), type='catmul_rom'))
xy.add('hermite finite_difference', hermite_interpolate(
*zip(*points), type='finite_difference'))
xy.add('hermite cardinal -.5', hermite_interpolate(
*zip(*points), type='cardinal', c=-.5))
xy.add('hermite cardinal .5', hermite_interpolate(
*zip(*points), type='cardinal', c=.5))
xy.add('hermite kochanek_bartels .5 .75 -.25', hermite_interpolate(
*zip(*points), type='kochanek_bartels', c=.5, b=.75, t=-.25))
开发者ID:aroraumang,项目名称:pygal,代码行数:31,代码来源:interpolate.py
注:本文中的pygal.XY类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论