Користувальницькькі налаштування

Налаштування сайту


gnuplot

Gnuplot

Gnuplot может работать как в режиме интерактивной командной строки (когда команды вводятся в командную строку Gnuplot последовательно, один за другим), так и в неинтерактивном режиме (когда в Gnuplot передаётся сразу весь список команд, составленный заранее). Так, например, сценарий

set terminal png;
plot "data2D.dat" with lines;

можно выполнить одной командой следующего вида:

gnuplot -e 'set terminal png; plot "data2D.dat" with lines;' | display

Здесь сам Gnuplot генерирует PNG-файл с графиком, который тут же направляется в утилиту display из пакета ImageMagick.

Простые примеры

set terminal png; 
plot "data2D.dat" with lines;

С логарифмической шкалой по осям X и Y и координатной сеткой:

set terminal png;
set logscale xy;
plot "data2D.dat" with lines;

gnuplot -e 'set terminal png; set yrange [0:300]; set xrange [0:5]; set xlabel "Energy, MeV"; set ylabel "Counts"; plot "Lab5-spectrum.build/out_spectrum.dat" using ($2):($3) with steps title "5GeV source, Water absorber"' | display

Разные примеры

gnuplot -e 'set terminal png; set ticslevel 2.5; set palette defined ( 0 "black", 1 "dark-blue", 1000 "green", 2000 "yellow",3000 "red");set pm3d at bs; splot "sheet01.txt" with pm3d' | display
gnuplot -e 'set terminal png crop; set title "Sheet"; set view 60,10; set ticslevel 2.5; set palette defined ( 0 "black", 1 "dark-blue", 1000 "cyan", 1500 "green", 2000 "yellow",3000 "red");set pm3d at bs; splot "sheet23.txt" with pm3d notitle' | display
gnuplot -e 'set terminal png crop; set title "Phase sheet 23" offset 0,-5; set view 60,10; set ticslevel 2.5; set palette defined ( 0 "black", 1 "dark-blue", 1000 "cyan", 1500 "green", 2000 "yellow",3000 "red"); set colorbox vertical user origin 0.9,0.1 size 0.03,0.7; set pm3d at bs; splot "sheet23.txt" with pm3d notitle' | display
gnuplot -e 'set terminal png crop size 600,800; set title "Phase sheet 23" offset 0,-10; set view 70,10; set ticslevel 1; set palette defined ( 0 "black", 1 "dark-blue", 1000 "cyan", 1500 "green", 2000 "yellow",3000 "red"); set colorbox vertical user origin 0.9,0.1 size 0.03,0.7; set ztics 0,500,3500; set pm3d at bs; splot "sheet23.txt" with pm3d notitle' | display
gnuplot -e 'set terminal png crop size 600,800; set title "Phase sheet 23" offset 0,-10; set view 70,10; set ticslevel 1; set palette defined ( 0 "black", 1 "dark-blue", 1000 "cyan", 1500 "green", 2000 "yellow",3000 "red"); set colorbox vertical user origin 0.9,0.1 size 0.03,0.7; set pm3d at bs; splot "sheet32.txt" with pm3d notitle' | display

Нанесение кружочков из таблицы на карту в виде Меркаторовской проекции

set terminal png;
set grid;
set title "Circles on Mercator projection"; 
set xrange [-180:180]; 
set yrange[log(tan(pi/4 + (-pi*70/180)/2)):log(tan(pi/4 + (pi*72.5/180)/2))]; 
set ytics ("0" 0, "-30" log(tan(pi/4 + (-pi/6)/2)), "30" log(tan(pi/4 + (pi/6)/2)),"-60" log(tan(pi/4 + (-pi/3)/2)), "60" log(tan(pi/4 + (pi/3)/2)), "-80" log(tan(pi/4 + (-pi*80/180)/2)), "80" log(tan(pi/4 + (pi*80/180)/2))); 
set xtics -180,30,180; 
plot "earthquakes2015-M3.dat" using ($3+360*floor(abs($3)/180)):(log(tan(pi/4 + (pi*$2/180)/2))):($5-3) with circles fill solid lc 2 title "Earthquakes-2015"

Хотя, намного умнее делать это при помощи GMT.

gnuplot -persist -e 'set terminal png size 1024,400; set xrange [0:100]; set xtics 0,5,100; plot "distribution_1.txt" with lines title "lambda = 1","distribution_2.txt" with lines title "lambda = 2","distribution_3.txt" with lines title "lambda = 3","distribution_4.txt" with lines title "lambda = 4","distribution_5.txt" with lines title "lambda = 5","distribution_6.txt" with lines title "lambda = 6","distribution_7.txt" with lines title "lambda = 7","distribution_8.txt" with lines title "lambda = 8","distribution_9.txt" with lines title "lambda = 9","distribution_10.txt" with lines title "lambda = 10","distribution_15.txt" with lines title "lambda = 15","distribution_20.txt" with lines title "lambda = 20","distribution_30.txt" with lines title "lambda = 30","distribution_40.txt" with lines title "lambda = 40","distribution_50.txt" with lines title "lambda = 50"' | display
gnuplot -persist -e 'set terminal png size 1024,400; set xrange [0:50]; set xtics ("1" 1, "2" 2, "3" 3, "4" 4, "5" 5, "6" 6, "7" 7, "8" 8, "9" 9, "10" 10, "15" 15, "20" 20, "30" 30, "40" 40, "50" 50, "100" 100); plot "distribution_1.txt" with lines title "lambda =  1","distribution_2.txt" with lines title "lambda =  2","distribution_3.txt" with lines title "lambda =  3","distribution_4.txt" with lines title "lambda =  4","distribution_5.txt" with lines title "lambda =  5","distribution_6.txt" with lines title "lambda =  6","distribution_7.txt" with lines title "lambda =  7","distribution_8.txt" with lines title "lambda =  8","distribution_9.txt" with lines title "lambda =  9","distribution_10.txt" with lines title "lambda = 10","distribution_15.txt" with lines title "lambda = 15","distribution_20.txt" with lines title "lambda = 20","distribution_30.txt" with lines title "lambda = 30"' | display

Поверхности

Из нерегулярной сетки точек

Полезные ссылки

gnuplot.txt · В останнє змінено: 2015/05/31 22:10 by wombat