Skip to content

Instantly share code, notes, and snippets.

@a-ludi
Created August 22, 2013 13:47
Show Gist options
  • Save a-ludi/6307378 to your computer and use it in GitHub Desktop.
Save a-ludi/6307378 to your computer and use it in GitHub Desktop.
Potting of Families of Curves and Palettes =============================== Further reading under http://wp.me/p31qg7-F
#!/usr/bin/gnuplot
set terminal pngcairo enhanced color \
font "cmr10,10" fontscale 1.3 \
size 890, 682
# Set the gaussian rgb-palette
G(x) = 0.855 * exp(-(x - 0.5)**2/0.25)
B(x) = 1.056 * exp(-x**2/0.49)
R(x) = B(1.0 - x)
gamma = 1.0
set palette functions R(gray**(1.0/gamma)), G(gray**(1.0/gamma)), B(gray**(1.0/gamma))
# Set some nice styling for grid, tics and borders
set style line 11 lc rgb '#808080' lt 1 lw 1
set border 3 back ls 11
set tics nomirror
set cbtics out
set style line 12 lc rgb '#808080' lt 0 lw 1
set style line 13 lc rgb '#D0D0D0' lt 0 lw 1
set grid back ls 12
# Request a higher sampling rate
set samples 500
set output "example-simple.png"
set title "Polynoms {/cmmi10=10 x^n} with Varying Degree"
set key bottom right
plot [x=-1:1] for [i=1:6] x**i with lines title sprintf("x^%i", i)
set output "example-palette.png"
set cbrange [1:6]
set cblabel "{/cmmi10=10 n}"
plot [x=-1:1] for [i=1:6] x**i with lines lc palette cb i notitle
set output "example-both.png"
unset title
set multiplot layout 1, 2 title "Polynoms {/cmmi10=10 x^n} with Varying Degree"
plot [x=-1:0] for [i=1:6] x**i with lines title sprintf("x^%i", i)
plot [x=-1:0] for [i=1:6] x**i with lines lc palette cb i notitle
unset multiplot
set output "example-non-uniform1.png"
set title "Polynoms {/cmmi10=10 x^n} with Varying Degree"
set cbrange [0.2:1]
set cblabel "{/cmmi10=10 n}"
T(i) = 1.0/i
gamma = 3.0
plot [x=0:1] for [i=1:5] x**T(i) with lines lc palette cb T(i) notitle
set output "example-non-uniform2.png"
set title "Polynoms {/cmmi10=10 x^n} with Varying Degree"
set cbrange [1:5]
set cbtics 1
set cblabel "{/cmmi10=10 1}/{/cmmi10=10 n}"
T(i) = 1.0/i
gamma = 1.0
set palette negative
plot [x=0:1] for [i=1:5] x**T(i) with lines lc palette cb i notitle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment