简体   繁体   English

gnuplot中叠加到曲面的曲线

[英]Curves superimposed to a surface in gnuplot

I am trying to create a plot with gnuplot where some curves are superimposed to a surface. 我正在尝试使用gnuplot创建一个绘图,其中一些曲线叠加到曲面上。 This is the code I use 这是我使用的代码

#!/usr/bin/gnuplot
xwidth=16.2
set size 1,1

set terminal epslatex color size xwidth cm,0.59*xwidth font 9 header '\fontsize{10}{13.2} \usepackage[lite,subscriptcorrection,slantedGreek,nofontinfo]{mtpro2}\usepackage{amsmath} \renewcommand{\rmdefault}{ptm}' dashlength 2.0 round standalone
set output "Pernal12.tex"
set border 0 lw 0
set lmargin 0
set rmargin 0
set tmargin 0
set bmargin 0
set multiplot

####
set size 0.55,1.166
set origin 0.02,-0.035

set xrange [0:10]
set yrange [-6:6]
set zrange [0:10]

unset ylabel
unset xlabel 

set format y ''
set format x ''
unset xtics
unset ytics
unset label 


set view map
set isosamples  400, 400
set style data pm3d
set style function pm3d
set pm3d implicit at b
#set grid noxtics noytics noztics front
#set palette positive nops_allcF maxcolors 0 gamma 1.5 gray
set palette defined (0 "white", 10 "black")

set pm3d interpolate 1,1
spacing 1.1
set cbrange[0:10]
unset colorbox
t={1,0}
e0={1,0}
eta={0.1,0}
i={0.0,1.0}
c(x)=sqrt(16*t**2+x**2)
a(x)=sqrt(2*((4*t/(c(x)-x))**2+1))
A(x)=(1-4*t/(c(x)-x))**2
B(x)=(1+4*t/(c(x)-x))**2
Gbup(x,y)=1/a(x)**2*(A(x)/(y-(e0+t+(c(x)+x)/2)+x/2+1+i*eta)+B(x)/(y-(e0+t-(c(x)-x)/2)+x /2+1+i*eta))
Gaup(x,y)=1/a(x)**2*(B(x)/(y-(e0-t+(c(x)+x)/2)+x/2+1+i*eta)+A(x)/(y-(e0-t-(c(x)-x)/2)+x/2+1+i*eta))
splot -imag(Gbup(x,y)+Gaup(x,y))/1.01 notitle




####
unset border
set border 15 lw 1
set size 0.385,0.83

set origin 0.087,0.11
unset xtics
unset ytics

set xrange [0:10]
set yrange [-6:6]
set zrange [0:20]
set xlabel '$U/t$'
set ylabel '$\omega/t$' offset 1.0,0
set xtics 5.0
set mxtics 5
set label '$n = 1/2$' left at graph 0,1 offset 2.2,-1.6 front
set xtics ("0" 0,"" 1 1,"" 2 1,"" 3 1,"" 4 1, '5' 5,"" 6 1,"" 7 1,"" 8 1,"" 9 1, '10' 10)
set ytics ( '-6' 6,"" 5 1,"-4" 4,"" 3 1,"-2" 2,"" 1 1, "0" 0,"" -1 1,"2" -2,"" -3 1,"4" -4, "" -5 1, "6" -6)


set grid noxtics noytics noztics front
plot    'Pernal12sym.dat'  u ($1):(-$8) w l lw 2.5 lc rgb "green"     lt 2 notitle

q

I obtain a nice figure but the problem is its dimension, more than 10 Mb. 我得到一个不错的数字,但问题是它的尺寸超过10 Mb。 I could reduce the isosamples value but then the surface map resolution would be too low. 我可以降低isosamples值,但是表面贴图分辨率会太低。 Is there a way to obtain a quite high resolution with a final .ps file whith a dimension under let's say 1Mb? 是否有一种方法可以使最终的.ps文件的分辨率达到1Mb,从而获得较高的分辨率?

I also tried to save before the surface map in png and than using this script 我也尝试在表面图之前保存为png,而不是使用此脚本

#!/usr/bin/gnuplot
xwidth=16.2
set size 1,1

set terminal epslatex color size xwidth cm,0.59*xwidth font 9 header '\fontsize{10}{13.2} \usepackage[lite,subscriptcorrection,slantedGreek,nofontinfo]{mtpro2}\usepackage{amsmath} \renewcommand{\rmdefault}{ptm}\usepackage{graphicx}' dashlength 2.0 round standalone
set output "Pernal12.tex"
set border 0 lw 0
set lmargin 0
set rmargin 0
set tmargin 0
set bmargin 0
set multiplot

####
set size 0.55,1.166
set origin 0.02,-0.035

set xrange [0:10]
set yrange [-6:6]
set zrange [0:10]

unset ylabel
unset xlabel 

set format y ''
set format x ''
unset xtics
unset ytics
unset label 

plot "Pernal13.png" binary filetype=png w rgbimage 

unset border
set border 15 lw 1
set size 0.385,0.83

set origin 0.087,0.11
unset xtics
unset ytics

set xrange [0:10]
set yrange [-6:6]
set zrange [0:20]
set xlabel '$U/t$'
set ylabel '$\omega/t$' offset 1.0,0
set xtics 5.0
set mxtics 5

set grid noxtics noytics noztics front
plot    'Pernal12sym.dat'  u ($1):(-$8) w l lw 2.5 lc rgb "green"     lt 2 notitle
q

But at the end I don't have my .png image as the background of the .ps file. 但是最后我没有将.png图像作为.ps文件的背景。

For that kind of plots (equidistant sampling in x- and y-directions) it is worth using the image plotting style. 对于这种绘图(在x和y方向上等量采样),值得使用image绘图样式。 Since I don't have the data file to test the whole script, here is the first part using plot '++' ... with image instead of splot ... with pm3d : 由于我没有数据文件来测试整个脚本,因此这是使用plot '++' ... with image的第一部分plot '++' ... with image而不是使用splot ... with pm3d

xwidth=16.2
set terminal epslatex color size xwidth cm,0.59*xwidth font 9 dashlength 2.0 round standalone
set output "Pernal12.tex"
unset border
set lmargin 0
set rmargin 0
set tmargin 0
set bmargin 0
set multiplot

####
set size 0.55,1.166
set origin 0.02,-0.035

set xrange [0:10]
set yrange [-6:6]
set zrange [0:10]

unset tics

set view map
set samples 1000
set isosamples  1000, 1000
set palette defined (0 "white", 10 "black")
set cbrange[0:10]
unset colorbox

t={1,0}
e0={1,0}
eta={0.1,0}
i={0.0,1.0}
c(x)=sqrt(16*t**2+x**2)
a(x)=sqrt(2*((4*t/(c(x)-x))**2+1))
A(x)=(1-4*t/(c(x)-x))**2
B(x)=(1+4*t/(c(x)-x))**2
Gbup(x,y)=1/a(x)**2*(A(x)/(y-(e0+t+(c(x)+x)/2)+x/2+1+i*eta)+B(x)/(y-(e0+t-(c(x)-x)/2)+x /2+1+i*eta))
Gaup(x,y)=1/a(x)**2*(B(x)/(y-(e0-t+(c(x)+x)/2)+x/2+1+i*eta)+A(x)/(y-(e0-t-(c(x)-x)/2)+x/2+1+i*eta))
plot '++' using 1:2:(-imag(Gbup($1,$2)+Gaup($1,$2))/1.01) with image notitle

The resulting .ps file is 938kB big. 生成的.ps文件大为938kB。 If you have the change to use the 5.0rc2 version, you can get down to 106kB with the level3 terminal option. 如果更改为使用5.0rc2版本,则可以使用level3终端选项降低到106kB。

BTW: It is quite pointless to use set size and set origin and also set all margins with set lmargin , bmargin , tmargin and rmargin . 顺便说一句:使用set sizeset origin并使用set lmarginbmargintmarginrmargin设置所有边距是没有意义的。 See also Big data surface plots: Call gnuplot from tikz to generate bitmap and include automatically? 另请参见大数据表面图:从tikz调用gnuplot生成位图并自动包含? .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM