Ruby:构建功能图

前端之家收集整理的这篇文章主要介绍了Ruby:构建功能图前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Ruby下构建函数图的最简单方法是什么?有关特殊图形库的任何建议吗?

更新:仅在Windows下:-(

更新2:发现以下宝石作为迄今为止https://github.com/clbustos/rubyvis的最佳解决方

解决方法

gnuplot是可能的选择吗?:
  1. require 'gnuplot.rb'
  2. Gnuplot.open { |gp|
  3. Gnuplot::Plot.new( gp ) { |plot|
  4. plot.output "testgnu.pdf"
  5. plot.terminal "pdf colour size 27cm,19cm"
  6.  
  7. plot.xrange "[-10:10]"
  8. plot.title "Sin Wave Example"
  9. plot.ylabel "x"
  10. plot.xlabel "sin(x)"
  11.  
  12. plot.data << Gnuplot::DataSet.new( "sin(x)" ) { |ds|
  13. ds.with = "lines"
  14. ds.linewidth = 4
  15. }
  16. plot.data << Gnuplot::DataSet.new( "cos(x)" ) { |ds|
  17. ds.with = "impulses"
  18. ds.linewidth = 4
  19. }
  20. }
  21. }

猜你在找的Ruby相关文章