Tcl/Tk中的绘图程序 [英] Graphing routines in Tcl/Tk

查看:399
本文介绍了Tcl/Tk中的绘图程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Tcl/Tk中做一些简单的绘图程序,例如散点图,x-y图,直方图.我正在使用Tcl/Tk 8.5.7.我在Tcler的Wiki中发现很少有诸如 BLT 之类的选项,而Tcl/Tk 8.5+不支持

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+

是否有到gnuplot的任何Tcl/Tk接口或任何完成绘图的小部件?

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

请让我知道Tcl/Tk中的绘图例程选择.

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

推荐答案

Gnuplot确实可以产生Tcl/Tk可以消耗的输出. Tcler的Wiki上的此页面描述了操作方式(尽管有些复杂,因为它正在制作动画).这是一个简化的版本:

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

gnuplot命令是通过对gnuplot 程序产生的输出进行eval uu创建的.这有点棘手,特别是如果您想进行多个绘图(提示:使用名称空间),但是使用起来非常简单.

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.

这篇关于Tcl/Tk中的绘图程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆