• 基础知识
import pygal
from IPython.display import SVG
from math import cos
xy_chart = pygal.XY()
xy_chart.title = 'XY Cosinus'
xy_chart.add('x = cos(y)', [(cos(x / 10.), x / 10.) for x in range(-50, 50, 5)])
xy_chart.add('y = cos(x)', [(x / 10., cos(x / 10.)) for x in range(-50, 50, 5)])
xy_chart.add('x = 1',  [(1, -5), (1, 5)])
xy_chart.add('x = -1', [(-1, -5), (-1, 5)])
xy_chart.add('y = 1',  [(-5, 1), (5, 1)])
xy_chart.add('y = -1', [(-5, -1), (5, -1)])
display(SVG(xy_chart.render()))

pygal文档——XY图(一)

  • 散点图
import pygal
from IPython.display import SVG
xy_chart = pygal.XY(stroke=False)
xy_chart.title = 'Correlation'
xy_chart.add('A', [(0, 0), (.1, .2), (.3, .1), (.5, 1), (.8, .6), (1, 1.08), (1.3, 1.1), (2, 3.23), (2.43, 2)])
xy_chart.add('B', [(.1, .15), (.12, .23), (.4, .3), (.6, .4), (.21, .21), (.5, .3), (.6, .8), (.7, .8)])
xy_chart.add('C', [(.05, .01), (.13, .02), (1.5, 1.7), (1.52, 1.6), (1.8, 1.63), (1.5, 1.82), (1.7, 1.23), (2.1, 2.23), (2.3, 1.98)])
display(SVG(xy_chart.render()))

pygal文档——XY图(一)

相关文章:

  • 2021-05-07
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
猜你喜欢
  • 2022-12-23
  • 2021-08-02
  • 2022-03-09
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
相关资源
相似解决方案