Graphing routines in Tcl/Tk

丶灬走出姿态 提交于 2019-12-06 05:22:00

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.

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

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