Skip to content

Instantly share code, notes, and snippets.

@LouisJenkinsCS
Created June 9, 2020 15:27
Show Gist options
  • Save LouisJenkinsCS/3da58ef2f3e65c76bcc73be3376690a1 to your computer and use it in GitHub Desktop.
Save LouisJenkinsCS/3da58ef2f3e65c76bcc73be3376690a1 to your computer and use it in GitHub Desktop.
GNUPlot Template
# From https://github.com/hesstobi/Gnuplot-Templates
load 'defaults.gp'
# Removes the annoying labels on X and Y axis that persist even after manually setting ylabel and xlabel
unset label
# Decent defaults for creating png
set terminal pngcairo enhanced size 1440,768 font 'Verdana,16';
set output 'template.png'
set ylabel 'Time'
set xlabel 'Size'
set xrange [1:1024]
set xtics ("2^0" 1, "2^1" 2, "2^2" 4, "2^3" 8, "2^4" 16, "2^5" 32, "2^6" 64, "2^7" 128, "2^8" 256, "2^9" 512, "2^{10}" 1024, "2^{11}" 2048, "2^{12}" 4096, "2^{13}" 8192, "2^{14}" 16384, "2^{15}" 32768, "2^{16}" 65536, "2^{17}" 131072, "2^{18}" 262144, "2^{19}" 524288, "2^{20}" 1048576)
set ytics ("0" 0, "10^-1" 0.1, "10^0" 1, "10^1" 10, "10^2" 100, "10^3" 1000, "10^4" 10000, "10^5" 100000, "10^6" 1000000, "10^7" 10000000, "10^8" 100000000, "10^9" 1000000000)
set logscale x 2
set logscale y 10
set title "Time Complexity Plot" font 'Verdana,26';
set key bottom right outside vertical box
plot 1 t 'O(1)' w lines lw 3 lc rgb "red", \
log(x) t 'O(log(N))' w lines lw 3 lc rgb "blue", \
x t 'O(N)' w lines lw 3 lc rgb "black", \
x * log(x) t 'O(N log(N))' w lines lw 3 lc rgb "green", \
x ** 2 t 'O(N^2)' w lines lw 3 lc rgb "purple"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment