原链接:http://blog.chinaunix.net/u3/105477/showart_2091176.html
关注点:
0.5 10
1.0 15
1.5 20
... ...
使用gnuplot时,可以一项一项地设置,逐步修改绘图环境;
使用命令: $gnuplot 从而进入 gnuplot> 模式,即可开始使用命令开始绘图;
假设有文件 file1, file2
则绘制基本命令为: gnuplot> plot "file1", "file2" //还有更多的文件是,分别用逗号隔开
不同文件的数据,软件会采用不同的颜色区分,效果很好!
坐标轴“量程”设置 set xtics $start,$incr,$end // ytics 类似
set xrange [$xmin:$xmax] // yrange
坐标标注: set xlabel "Simulation time" // ylabel类似
设置图片的标题: set title "TITLE"
2.画线段
set arrow {tag} {from sx,sy}{,sz} {to sx,sy}{,sz} {{no} head}
设置一条线条id 为: tag, 从起点到终点, 是否带箭头;
其中的{} 表示该选项是可选的!
unset arrow {tag} //删除 tag 线条
3.线条类型的定义 plot "FILE" with <选项>
选项的可用值:
lines, points, linespoints, impluses(引垂线到X轴)
dots, steps,
errorbars, boxes, boxerrorbars
4.输出
gnuplot> set terminal gif
gnuplot> replot //产生了一个 file.gif 的图片
1 0.1397 2 0.1731 3 0.1624 4 0.1927 5 0.1164 6 0.134 7 0.164 8 0.1648 9 0.1894 10 0.1722 |
1 0.1792 2 0.1758 3 0.1789 4 0.15 5 0.1736 6 0.1829 7 0.1915 8 0.1765 9 0.1577 10 0.1316 |
1 0.1314 2 0.1043 3 0.129 4 0.1189 5 0.1046 6 0.087 7 0.1053 8 0.1059 9 0.1068 10 0.0682 |
1 0.1066 2 0.0796 3 0.0874 4 0.1065 5 0.0778 6 0.0761 7 0.084 8 0.0953 9 0.082 10 0.0822 |
1 0.924 2 0.972 3 0.961 4 0.9983 5 0.8362 6 0.9069 7 0.841 8 0.9934 9 0.9828 10 0.87 |
1 0.9432 2 0.925 3 0.9299 4 0.8408 5 0.9087 6 0.964 7 0.9934 8 0.906 9 0.8692 10 0.9052 |
1 0.8314 2 0.8022 3 0.6945 4 0.704 5 0.7824 6 0.6456 7 0.6672 8 0.7344 9 0.7032 10 0.6332 |
1 0.6778 2 0.6267 3 0.5813 4 0.6593 5 0.5782 6 0.5406 7 0.5558 8 0.5645 9 0.6118 10 0.559 |
gnuplot> plot "Node A1" with linespoints,"Node A2" with linespoints, "Node A3" with linespoints, "Node A4" with linespoints gnuplot> set terminal gif gnuplot> set output "file.gif" gnuplot> replot |
gnuplot> plot "Zhu--A1" with linespoints,"Zhu--A2" with linespoints, "Zhu--A3" with linespoints, "Zhu--A4" with linespoints gnuplot> set terminal gif gnuplot> set output "zhu.gif" gnuplot> replot |


gnuplot> set title "Grey Projection for Node A1-A2-A3-A4" gnuplot> set xlabel "Simulation time" gnuplot> set ylabel "Values" gnuplot> set yrange [-0.3:0.23] gnuplot> plot "Node A1" with linespoints,"Node A2" with linespoints, "Node A3" with linespoints, "Node A4" with linespoints gnuplot> set terminal gif gnuplot> set output "GreyProjection.gif" gnuplot> replot |
gnuplot> set title "Main attibutes for Node A1-A2-A3-A4" gnuplot> set xlabel "Simulation time" gnuplot> set ylabel "Values" gnuplot> set yrange [-0.2:1.1] gnuplot> plot "Zhu--A1" with linespoints,"Zhu--A2" with linespoints, "Zhu--A3" with linespoints, "Zhu--A4" with linespoints gnuplot> set terminal gif gnuplot> set output "zhu.gif" gnuplot> replot |

