下面的安装过程是在ubuntu20.04上进行的。

安装gnuplot需要依赖lua5.2。所以先安装lua5.2

安装lua5.2

下载安装包

wget http://www.tecgraf.puc-rio.br/lua/ftp/lua-5.2.0.tar.gz

编译安装lua5.2

解压后进入源码目录

make linux
sudo make install

安装gnuplot

gnuplot主页:http://www.gnuplot.info/

gnuplot需要编译源码安装。首先到下面的网址下载源码。

下载网址:

https://sourceforge.net/projects/gnuplot/files/gnuplot/5.4.3/

编译安装gnuplot

./configure              # prepare Makefile and config.h
make                     # build the program and documentation
make check               # run unit tests to confirm successful build
sudo make install             # install the program and documentation

使用gnuplot

将下面的内容保存为show.plt。替换需要显示的数据文件,然后执行该脚本即可。

#!/usr/local/bin/gnuplot

set size ratio -1;
plot "test_path.txt" using 1:2:3 with labels offset -1,0.5 point pt 1 ps 1 lc rgb "blue" notitle
# plot "test2" u 1:2 t "Dawn" pt 1 ps .1
# plot "weird.path" u 1:2 smooth bezier
pause -1;

该脚本支持的数据存储形式为

42.7901 36.8747 0
43.3355 36.8601 1
43.99 36.9039 2

显示效果:

gnuplot还有很多功能,这样简单介绍一下。


觉得有用就点赞吧!

我是首飞,一个帮大家填坑的机器人开发攻城狮。

另外在公众号《首飞》内回复“机器人”获取精心推荐的C/C++,Python,Docker,Qt,ROS1/2等机器人行业常用技术资料。

公众号