alex
alex

Reputation: 1439

How to make this gnuplot diagram

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

Upvotes: 4

Views: 438

Answers (1)

Miguel
Miguel

Reputation: 7627

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

Upvotes: 4

Related Questions