如何将 gnuplot 输出替换为 PSQL 内部的图像输出(保持打开状态)?
how could I replace gnuplot output to image (keep it open) output from inside PSQL?
如何将 gnuplot 输出替换为 PSQL 内部的图像输出(保持打开 window)?
所以我想在图形上输出它,使我的用户更容易阅读,
我的意思是,当他们启动脚本时,他们会弹出一个带有图形的 Xorg window,直到他们自己关闭 window。
目前,我使用这种测试:
francois@zaphod:~/Documents/DEV/sh/pgsqlplot$ cat commands
\t
\a
\f ' '
\o | /usr/bin/gnuplot
select 'set title "My test Graph"; set terminal dumb 128 52; set key off; set ylabel "something"; set xlabel "temp";' || 'plot ''-'' with lines;' ;
select something from temp where date >= '2018-01-01' order by date ;
\o
francois@zaphod:~/Documents/DEV/sh/pgsqlplot$ psql perso < commands
所以我得到了一个这样的终端伪图:
3000 +-+--------------------+-----------------------+----------------------+-----------------------+--------------------+-+
+ + + + + +
| * |
| ** |
| * * |
| * * |
| * * |
2500 +-+ * * * +-+
[...等等...]
我在 gnuplot 和 gluplot 文档中都没有找到好的帮助页面。
你能帮我调整命令文件以使用 gnuplot 和 postgres 周围的正确选项吗?
我尝试使用 set terminal jpeg large font arial size 2048,768 & \o | /usr/bin/gnuplot --persist 但后来我在终端上得到了 jpeg 二进制内容
首先,选择一个 window 终端。通常我希望默认终端,即在没有明确 set terminal
命令的情况下选择的终端,是 window 终端。在我的例子中,它是 qt
终端,但还有其他选项,如 set terminal x11
。您可以从 gnuplot 中使用 set terminal
命令获取列表。作为第一次尝试,我将删除 set terminal dumb
命令。
其次,要保持window打开,我看到两种可能性:
在调用 gnuplot 时添加 -persist
命令行选项。
这将关闭 gnuplot 并完成您的脚本。
在 gnuplot 脚本中使用 pause mouse close
命令。
这不会关闭 gnuplot,但会保留使用鼠标和键盘快捷键进行缩放、添加网格等的可能性。
使用选项 2,我们得到这个脚本(我重新排列了行以避免滚动):
\t
\a
\f ' '
\o | /usr/bin/gnuplot
select 'show terminal';
select 'set title "My test Graph"';
select 'set key off';
select 'set ylabel "something"';
select 'set xlabel "temp"';
select 'plot ''-'' with lines';
select something from temp where date >= '2018-01-01' order by date ;
select 'e';
select 'pause mouse close';
\o
行 select 'show terminal';
在我的例子中打印 qt
。 select 'e';
行表示
没有更多数据可以绘制。
使用选项 1,调用 gnuplot 的行将是 \o | /usr/bin/gnuplot -persist
。
以防万一你想切换到文件输出,你必须添加输出文件的名称:
select 'set terminal jpeg';
select 'set output "filename.jpg"';
...
select 'plot ...
如何将 gnuplot 输出替换为 PSQL 内部的图像输出(保持打开 window)?
所以我想在图形上输出它,使我的用户更容易阅读,
我的意思是,当他们启动脚本时,他们会弹出一个带有图形的 Xorg window,直到他们自己关闭 window。
目前,我使用这种测试:
francois@zaphod:~/Documents/DEV/sh/pgsqlplot$ cat commands
\t
\a
\f ' '
\o | /usr/bin/gnuplot
select 'set title "My test Graph"; set terminal dumb 128 52; set key off; set ylabel "something"; set xlabel "temp";' || 'plot ''-'' with lines;' ;
select something from temp where date >= '2018-01-01' order by date ;
\o
francois@zaphod:~/Documents/DEV/sh/pgsqlplot$ psql perso < commands
所以我得到了一个这样的终端伪图:
3000 +-+--------------------+-----------------------+----------------------+-----------------------+--------------------+-+
+ + + + + +
| * |
| ** |
| * * |
| * * |
| * * |
2500 +-+ * * * +-+
[...等等...]
我在 gnuplot 和 gluplot 文档中都没有找到好的帮助页面。 你能帮我调整命令文件以使用 gnuplot 和 postgres 周围的正确选项吗?
我尝试使用 set terminal jpeg large font arial size 2048,768 & \o | /usr/bin/gnuplot --persist 但后来我在终端上得到了 jpeg 二进制内容
首先,选择一个 window 终端。通常我希望默认终端,即在没有明确 set terminal
命令的情况下选择的终端,是 window 终端。在我的例子中,它是 qt
终端,但还有其他选项,如 set terminal x11
。您可以从 gnuplot 中使用 set terminal
命令获取列表。作为第一次尝试,我将删除 set terminal dumb
命令。
其次,要保持window打开,我看到两种可能性:
在调用 gnuplot 时添加
-persist
命令行选项。这将关闭 gnuplot 并完成您的脚本。
在 gnuplot 脚本中使用
pause mouse close
命令。这不会关闭 gnuplot,但会保留使用鼠标和键盘快捷键进行缩放、添加网格等的可能性。
使用选项 2,我们得到这个脚本(我重新排列了行以避免滚动):
\t
\a
\f ' '
\o | /usr/bin/gnuplot
select 'show terminal';
select 'set title "My test Graph"';
select 'set key off';
select 'set ylabel "something"';
select 'set xlabel "temp"';
select 'plot ''-'' with lines';
select something from temp where date >= '2018-01-01' order by date ;
select 'e';
select 'pause mouse close';
\o
行 select 'show terminal';
在我的例子中打印 qt
。 select 'e';
行表示
没有更多数据可以绘制。
使用选项 1,调用 gnuplot 的行将是 \o | /usr/bin/gnuplot -persist
。
以防万一你想切换到文件输出,你必须添加输出文件的名称:
select 'set terminal jpeg';
select 'set output "filename.jpg"';
...
select 'plot ...