Freelance Projects

Upeksha Wisidagama

Gnuplot Basics - 2D Plots

Let’s start with a basic two dimensional plot. Create the data file (uw.dat).

‘Data File (uw.dat)’
1
2
3
4
5
6
7
8
9
10
1,  5
2,  4
3,  6
4, 10
5,  2
6,  1
7,  0
8,  5
9,  7
10, 9

Create the plot configuration file (uw.config).

‘Configuration File (uw.config)’
1
2
3
set term png size 600, 400
set output "uw.png"
plot "uw.dat" with lines

Now, plot using gnuplot uw.config.

Ubuntu Server Login

Draw an Arrow

To draw and arrow from (3,2) to (6,8), use set arrow from 3,2 to 6,8. To specify end coordinate relative to the starting use rto instead to. e.g. set arrow from 3,2 rto 1,1.

Plotting the Exam Results of My Friends

These are the marks taken by each of the friends. Format: Name, Marks.

‘Exam Results (marks.dat)’
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Alice 20
Bob 63
Charlie 56
Chuck 42
Craig 36
Dave 86
Erin 45
Frank 87
Eve 78
Mallory 2
Oscary 44
Peggy 12
Trent 56
Walter 55
Arthur 42
Paul 45
Upeksha 55

A brief description of each of the friends

Alice and Bob. Generally, Alice wants to send a message to Bob. Carol, Carlos or Charlie, as a third participant in communications.

Chuck, as a third participant usually of malicious intent.

Craig, the password cracker (usually encountered in situations with stored hashed/salted passwords).

Dan or Dave, a fourth participant. Erin, a fifth participant. (It’s rare to see Erin; E is usually reserved for Eve.) Frank, a sixth participant (and so on alphabetically).

Eve, an eavesdropper, is usually a passive attacker. While she can listen in on messages between Alice and Bob, she cannot modify them. In quantum cryptography, Eve may also represent the environment.

Mallet or Mallory, a malicious attacker (less commonly called Trudy, an intruder.); unlike the passive Eve, this one is the active man-in-the-middle attacker who can modify messages, substitute his/her own messages, replay old messages, and so on. The difficulty of securing a system against Mallet/Mallory is much greater than against Eve.

Oscar, an opponent, similar to Mallet/Mallory but not necessarily malicious. Could be white-hat but still wants to crack, modify, substitute, or replay messages. Peggy, a prover, and Victor, a verifier, often must interact in some way to show that the intended transaction has actually taken place. They are often found in zero-knowledge proofs. Trent, a trusted arbitrator, is some kind of neutral third party, whose exact role varies with the protocol under discussion.

Walter, a warden, may be needed to guard Alice and Bob in some respect, depending on the protocol being discussed. Arthur and Merlin: In interactive proof systems, the prover has unbounded computational ability and is hence associated with Merlin, the powerful wizard. He claims the truth of a statement, and Arthur, the wise king, questions him to verify the claim.

Paul and Carole. The characters were introduced in the solution of the Twenty Questions problem

Source: This list is drawn mostly from the book Applied Cryptography by Bruce Schneier. Alice and Bob are archetypes in cryptography; Eve is also common. Names further down the alphabet are less common. Read More

Now you know most of my friends, Let’s create the plot config file.

‘Exam Results Plot Config (marks.config)’
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
set term png truecolor size 750, 400
set output "marks.png"

set grid
set boxwidth 0.8 relative
set style fill transparent solid 0.5 noborder
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"#ccffff" behind

set xlabel "Names of Friends"
set ylabel "Marks"
set title "Marks of the Friends of Upeksha"
set yrange [0:100]
set ytics 0,10

set xtics rotate
plot 'marks.dat' using 2:xticlabels(1) with boxes notitle

Run gnuplot marks.config.

Marks of Friends of Upeksha

Despite gnuplot’s name, it is not part of or related to the GNU Project, nor does it use the GNU General Public License. You should always use simple ‘g’: ‘gnuplot’.