Xgraph is an X-Windows application that includes:
- interactive plotting and graphing
- animation and deritives
- portability and bug fixes
So to plot the characteristics of NS2 parameters like throughput, end to end delay, packets information, etc can be plotted using xgraph
The successful installation of NS2 will install xgraph also along with it.
To run xgraph from a shell prompt: # xgraph filename.xg
inside TCL scripts, xgraph can be written like this
exec xgraph filename.xg -geometry 500×500
if there are more xgraph files then,
exec xgraph filename1.xg -geometry 500×500 &
exec xgraph filename2.xg -geometry 500×500 &
The ambersand is mandatory to popup all the graph windows, if & (ambersand) is not there, then only the last xgraph window will be popped up.
Sample xgraph file and its contents
/*** The xgraph file shows the information about the overhead with size of the network,
Overhead is compared with four routing protocols like AODV, DSR, DSDV and NEAODV (my own algorithm)
the values are taken from various trace files.
To execute the following xgraph file, copy the following contents and save it as “example.xg” possibly (other formats also supported) and in the shell prompt # xgraph example.xg
TitleText: Overhead (Kbits/s) Vs Network Size
XUnitText: Network Size (nodes)
Output window will be looking like this