/examples/d3py_area.py

https://github.com/followyourheart/d3py · Python · 21 lines · 18 code · 3 blank · 0 comment · 1 complexity · 39417ed3f55fa00c8a7c7b3ef3c6eeb8 MD5 · raw file

  1. import numpy as np
  2. import d3py
  3. import pandas
  4. N = 500
  5. T = 5*np.pi
  6. x = np.linspace(-T,T,N)
  7. y = np.sin(x)
  8. y0 = np.cos(x)
  9. df = pandas.DataFrame({
  10. 'x' : x,
  11. 'y' : y,
  12. 'y0' : y0,
  13. })
  14. with d3py.PandasFigure(df, 'd3py_area', width=500, height=250) as fig:
  15. fig += d3py.geoms.Area('x', 'y', 'y0')
  16. fig += d3py.geoms.xAxis('x')
  17. fig += d3py.geoms.yAxis('y')
  18. fig.show()