4

This is my gnuplot digram. My digram is this:

enter image description here

I want to create this one:

enter image description here

  1. From each point on the line. create a line to X and Y:
  2. Change the color of the points to another thing than red.

This is my plot script:

set terminal png size 900,600 enhanced font "Helvetica,20" 
set output 'All recived Packet in the network per second.png'
set grid
set xlabel "Transmision Range"
set ylabel "All of recived Packet in the network per second"
set title "Recive Packet pre second"
plot  "NumOfRcvPkt.dat" using 2:3 title 'Transmision Range' with  linespoints

Also here is the content of NumOfRcvPkt.dat file:

0 15 124
1 20 105
2 25 82
alex
  • 1,319
  • 3
  • 16
  • 28

1 Answers1

4

This is achieved as follows:

xmin=14 ; ymin=80
set xrange [xmin:*] ; set yrange [ymin:*]
plot "data" u 2:3 w l lc rgb "red", \
"" u 2:3 w p pt 7 lc rgb "blue", \
"" u (xmin):3:($2-xmin):(0) w vectors nohead lt 2 lc rgb "black", \
"" u 2:(ymin):(0):($3-ymin) w vectors nohead lt 2 lc rgb "black"

The first two lines set the ranges. This is important because you need to know where the edges lie in order to draw your black dashed lines.

Then, for the plot command, the first line plots the data with red lines, the second plots the data with blue circles, the third one plots horizontal black dashed lines and the fourth one plot vertical dashed lines. In order for your terminal to accept dashed styles (selected with lt 2) you need to add dashed, e.g. set term png dashed.

This is the result:

enter image description here

Miguel
  • 7,497
  • 2
  • 27
  • 46
  • 4
    If `ymin > 0` one can also use the `impulses` plotting style for the vertical lines. – Christoph Aug 06 '14 at 09:04
  • @Christoph hi Christoph . if I want to change the position of the diagram help what I should do? what are the keyword for google search. diagram help is that part which shows descriptions about the line on the diagram. for example the line is " data u 2:3 "" on the above diagram – alex Jan 26 '15 at 10:21
  • @Christoph oh thanks I find that http://stackoverflow.com/questions/12208054/gnuplot-legend-overlaps-graph – alex Jan 26 '15 at 10:29
  • 1
    @alex In gnuplot this is called the `key`. There are various options to set the position: e.g `set key bottom left`, or `set key at graph 0.3, screen 0.3` etc – Christoph Jan 26 '15 at 10:29