PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/examples/d3py_multiline.py

https://github.com/followyourheart/d3py
Python | 22 lines | 19 code | 3 blank | 0 comment | 1 complexity | df1370db5ec8fc692e0699ce0a3bf14e MD5 | raw file
  1. import numpy as np
  2. import d3py
  3. import pandas
  4. T = 5*np.pi
  5. x = np.linspace(-T,T,100)
  6. a = 0.05
  7. y = np.exp(-a*x) * np.sin(x)
  8. z = np.exp(-a*x) * np.sin(0.5*x)
  9. df = pandas.DataFrame({
  10. 'x' : x,
  11. 'y' : y,
  12. 'z' : z,
  13. })
  14. with d3py.PandasFigure(df, 'd3py_line', width=600, height=200) as fig:
  15. fig += d3py.geoms.Line('x', 'y', stroke='BlueViolet')
  16. fig += d3py.geoms.Line('x', 'z', stroke='DeepPink')
  17. fig += d3py.xAxis('x')
  18. fig += d3py.yAxis('y')
  19. fig.show()