gnuplot绘图程序中对线型(linetype)、点型(pointtype)、线条宽度(linewidth)、点大小(pointsize)、图样

作者:magj77

原作网址:http://blog.sina.com.cn/s/blog_6a5f098201013tvb.html


NS2gnuplot绘图程序中对线型(linetype)、点型(pointtype)、线条宽度(linewidth)、点大小(pointsize)、图样(style)都有相应的设定值,具体设置如下:

(1)线型(linetype )。在此类型中主要设置线条的颜色,具体对应如下:

n

0

1

2

3

4

5

6

linetype

black

red

green

blue

pink

浅蓝

yellow

(2)点型(pointtype)。此类型用于设置点得形状,可分为14中,具体对应如下:

n

0

1

2

3

4

5

6

7

8

9

10

11

12

13

pointtype

+

×

*

3)线条宽度(linewidth)、点大小(pointsize)。两者都可以设置为整数或小数。

4)图样(style)gnuplot 描绘数据数据图形是以读入档案中的坐标值后,以图样绘上。gnuplot可提供9种图样,分别是:

ü  lines : 将相邻的点以线条连接。如 plot sin(x) withlines

ü  points : 将每一点以一符号绘上。如 plot sin(x) withpoints

ü  linespoints : 同时具有lines points 的功能。

ü  impulses : 将每一点画一垂直线至X 轴。如 plot sin(x) withimpulses

ü  dots : 将每一点绘一细点。如plot sin(x) withdots

ü  steps : 以垂直线及水平线各一条来连接两点,形成梯形。如连接 (x1,y1)(x2,y2)两点,以(x1,y1)(x2,y1)(x2,y1)(x2,y2) 两线段连接。如 plot sin(x) withsteps

ü  errorbars : 对每一点坐标值(x,y),画一由(x,ylow) (x,yhigh) 的线段。并在线段两端做上 tic mark。如plot sin(x) witherrorbars

ü  boxes : The boxes style draws a box centredabout the given x coordinate from the yaxis to the given ycoordinate.plot sin(x) withboxes

ü  boxerrorbars : 组合errorbars boxes 两者功能。如 plot sin(x) withboxerrorbars

(5) 图例(key

     若想改变显示的图例名称,可通过下述语句实现:

       plot 'node1'title“node_1”     #将图例显示的名称从“node1”改为“node_1”

     也可以通过下述语句直接在画线条时显示:

       plot 'node1' title“node_1”withlines

下为一个具体例子的应用程序:

gnuplot> set title“cbr_delay” font “Times-Roman,12” #该图的标头为cbr_delay,字体大小为12

gnuplot> set xlabel“simulationtime”                 #该图x轴的标示为simulation time

gnuplot> set ylabel“delaytime”                        #该图y轴的标示为simulation time

gnuplot> xrange[0:10]                                       #设置x轴的坐标范围为010

gnuplot> xtics0,1,10                                          #设置x轴的坐标在010 之间以1为间隔分布

gnuplot> plot 'node1'with linespoints lt 0 lw 2 pt 1 ps 1.5      #绘制node1,线为黑色,线宽为2

点的形状为“+”,点的大小为1.5

#下一语句实现的功能为在同一个gnuplot图上绘制node2,线为黑色,线宽为2,点的形状为“×”,点的大小为1.5

gnuplot> replot 'node2' with linespoints lt 0 lw2 pt 2 ps1.5             

上面设置实现的功能为:绘出两个节点的线形图,该图的标头为cbr_delay,字体大小为12号,x轴和y轴的表示分别为simulation timedelay timeX轴的坐标范围为010,之间以1为间隔标示。两个节点都是以linespoints图样绘制,线条颜色均为黑色,节点1的点形状为“+”,节点2的点形状为“×”

Replot命令使得可以在同一张图中添加更多的图。例如,输入plot sin(x)后,尝试输入replot cos(x)。依照语法,该命令等同于plot sin(x), cos(x)Replot 就是获取先前的绘图字符串,添加必要的逗号,然后附加输入给它的其余部分。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值