Reputation: 125
I am trying to create a plot with gnuplot where some curves are superimposed to a surface. 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. I could reduce the isosamples value but then the surface map resolution would be too low. Is there a way to obtain a quite high resolution with a final .ps file whith a dimension under let's say 1Mb?
I also tried to save before the surface map in png and than using this script
#!/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.
Upvotes: 1
Views: 355
Reputation: 48390
For that kind of plots (equidistant sampling in x- and y-directions) it is worth using the image
plotting style. 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
:
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. If you have the change to use the 5.0rc2 version, you can get down to 106kB with the level3
terminal option.
BTW: It is quite pointless to use set size
and set origin
and also set all margins with set lmargin
, bmargin
, tmargin
and rmargin
. See also Big data surface plots: Call gnuplot from tikz to generate bitmap and include automatically?.
Upvotes: 1