Graphing routines in Tcl/Tk

ぃ、小莉子 提交于 2019-12-22 11:33:04

问题


I want to do simple graphing routines in Tcl/Tk like scatter plot, x-y plot, histograms. I am using Tcl/Tk 8.5.7. I found in Tcler's wiki that there are few options such as BLT which is not supported in Tcl/Tk 8.5+

Is there any Tcl/Tk interface to gnuplot or any widget to accomplish graphing?

Please let me know about the choices for graphing routines in Tcl/Tk.


回答1:


Gnuplot can indeed produce output that Tcl/Tk can consume. This page on the Tcler's Wiki describes how (though with some extra complexity because it is doing animations). Here's a simplified version:

package require Tk
eval [exec gnuplot << "
    set term tk
    plot x*x
"]
pack [canvas .c]
gnuplot .c

The gnuplot command is created by evaluating the output that the gnuplot program produced. This is a little bit tricky, especially if you're wanting to do multiple plots (hint: use namespaces) but it is pretty simple to use.




回答2:


You could also use the simple tklib plotchart package for some simpler things. http://tcllib.sourceforge.net/doc/plotchart.html



来源:https://stackoverflow.com/questions/9073329/graphing-routines-in-tcl-tk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!