Discontinuous patches in surface plot


Sometimes surface plots (Plot3D) in Mathematica can show discontinuous patches.

Use exclusions none (Make sure the exclusions are unphysical)


Plot3D[Re[Bands[J1val, J2val, kxval, kyval]], {kxval, kxv – delta,
kxv + delta}, {kyval, kyv – delta, kyv + delta}, Exclusions -> None]

courtesy and more details:



Make xtics /ytics in gnuplot a column in data file

plot "datafile.dat" using 1:3:xtic(2) with points





gnuplot script file

do for [a=1000:2000] {
set term x11 0
pl ‘./GenEigfun_107.txt’ u 1:2:3 every :::a::a w p pt 7 ps 2 palette t sprintf(“%.3f”,a)
set term x11 1
set arrow from a, graph 0 to a, graph 1 nohead
pl ‘./GenEigen_107.txt’ u 3 w p t sprintf(“%.3f”,a)
unset arrow
pause 0.5

opens two windows, plots the eigenfucntions (1000-2000) as you move through the eigenvalues


plot (and watch) a data movie in gnuplot

Imagine you have  a data file with some parameter changing. And a 2d plot corresponding to each value of this parameter.

Now say, you save a data file data.txt, with multiple blocks(each block should be separated from each other by a single line). And each block corresponds to a unique value of that parameter.

Now you want to see live, how the two d plot changes with this parameter slowly changing. (this parameter could very well be time)

The do for loop in gnuplot is very powerful..

say ‘a’ was that parameter

the every command chooses block by block

pause command waits for 0.5 seconds (can be tuned)

save the following commands in a file and run it using gnuplot.

In order to make  a movie one can save each of these files and then make movie using other software


do for [a=1:100] {
pl ‘./data.txt’ u 1:2:3 every :::a::a w p pt 7 palette
pause 0.5




replace string in file using vi




s: substitute

64: quantity you want to replace

32: replace with

g: globally in the full file

c: asks for each match



Courtesy: Aabhaas 🙂



Find minima of a data in gnuplot and then print to a file