来自标准输入的实时绘图

发布于 2024-10-01 04:23:52 字数 67 浏览 1 评论 0原文

我有一个将数字打印到标准输出的应用程序。有没有一种简单的方法可以使用任何命令行绘图工具(gnuplot)来实时绘制图像?

I have an application which prints numbers to stdout. Is there an easy way of using any commandline plot tool (gnuplot) for a live plot of the image?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

与之呼应 2024-10-08 04:23:52

我强烈推荐 ttyplot,您可以直接在终端中构建实时图表,从 STDIN 读取数据

在此处输入图像描述

另一种选择是使用 sampler:用于 shell 命令执行、可视化和警报的工具。使用简单的 YAML 文件进行配置。

输入图像描述这里

I would highly recommend ttyplot, you can build live graphs directly in the terminal, reading data from STDIN

enter image description here

Another option is to use sampler: Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

enter image description here

好听的两个字的网名 2024-10-08 04:23:52

您可以将数字重定向到文件,并使用 gnuplot 的重读命令或在绘图窗口上手动按 e 定期读取该文件。

shell$ command > points.dat

在 gnuplot 中

gnuplot> plot "points.dat" using 1:2

并按窗口上的 e 来更新它,或者查看示例

gnuplot> help reread

You can redirect the numbers to a file and read the file periodically either using gnuplot's reread command or manually pressing e on the plot window.

shell$ command > points.dat

In gnuplot

gnuplot> plot "points.dat" using 1:2

and press e on the window to update it, or see the example from

gnuplot> help reread
岁月如刀 2024-10-08 04:23:52

我为此编写了 livechart
目的。它基于 matplotlib,接受数字或 JSON 对象
通过 stdin 获取数字数据。

sudo pip install livechart

请注意,建议使用 Python2.7,因为 matplotlib 不太适合
我3.x以下。另外,您可能需要安装 C++ 编译器来构建
matplotlib(Debian 上sudo apt-get install g++)。

I wrote livechart for exactly this
purpose. It's based on matplotlib and accepts either numbers or JSON objects
with numeric data via stdin.

sudo pip install livechart

Note that Python2.7 is recommended because matplotlib wouldn't quite work for
me under 3.x. Also, you might need to install a C++ compiler to build
matplotlib (sudo apt-get install g++ on Debian).

话少心凉 2024-10-08 04:23:52

您可以使用 plotti.co 将您的绘图导出到网络上,如下所示:

<program> | xargs -L1 sh -c 'wget -q -O /dev/null http://plotti.co/4134314?d=$0'

您将实时查看它地址 http://plotti.co/4134314/plot.svg

免责声明:I我是plotti.co 的创建者

You can use plotti.co to export your plot to the web in a one-liner like this:

<program> | xargs -L1 sh -c 'wget -q -O /dev/null http://plotti.co/4134314?d=$0'

And you will view it live at address http://plotti.co/4134314/plot.svg

Disclaimer: I am the creator of plotti.co

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文