Plot x as 1,2,3….. and y axis

plot "data.txt" u ($0):4 title "Plotting with x innumeration"
  • ($0) represents the line number.

Plot histogram

set terminal png
set output 'histogram.png'
set style data histogram
set style fill solid
set xlabel 'Angles(°)'
set ylabel 'Normalized Frequency'
set title 'Angles distribution for α'
bin_width = 1
bin(x, width) = width * floor(x / width) + bin_width / 2.0
stats 'angles.txt' nooutput
total_points = STATS_records
plot 'angles.txt' using (bin($1, bin_width)):(1.0/total_points) smooth freq with boxes lc rgb 'blue' notitle
  • above bin_width controls the sampling density or width of each bin.
  • dividing by total_points normalizes the plot, remove this for unnormalized graphs
  • the input files angles.txt is assumed to have single column containing all the data.