GNUplot 是开源跨平台命令行绘图工具 ,支持 2D/3D 数据可视化、函数绘图、动态图表生成等功能,广泛应用于科研论文、工程数据分析等领域。其核心特性包括:
平台 | 最低版本要求 | 推荐配置 |
---|---|---|
Windows | 7 (64位) | Windows 10 21H2 |
macOS | Catalina (10.15) | macOS Sonoma |
Linux | Ubuntu 18.04 | Ubuntu 22.04 LTS |
sudo apt-get install libwxgtk3.2-dev
安装图形库访问GNUplot官网安装包下载页 ,下载对应的 【gp548-win64-mingw.rar】文件
gp548-win64-mingw.exe
启动安装向导wget https://sourceforge.net/projects/gnuplot/files/gnuplot/5.4.0/gnuplot-5.4.0.tar.gz tar -xzvf gnuplot-5.4.0.tar.gz cd gnuplot-5.4.0 ./configure && make && sudo make install
gnuplot> set terminal pngcairo # 设置输出格式 gnuplot> set output "sin.png" # 指定输出文件 gnuplot> plot sin(x) with lines # 生成正弦曲线
创建 data.dat
文件:
# X Y
1 2
2 5
3 8
4 6
执行命令:
gnuplot> plot 'data.dat' using 1:2 with points
set title "温度变化曲线" set xlabel "时间(小时)" set ylabel "温度(℃)" set grid plot "temp.dat" with linespoints lt rgb "blue"
set multiplot layout 2,1 plot "dataset1.dat" plot "dataset2.dat" unset multiplot
DISPLAY=localhost:0.0
export DISPLAY=:0
set terminal svg enhanced background rgb "white" set output "chart.svg" replot
提示:本文使用 GNUplot 5.4 版本演示,原创教程转载请注明出处 。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。