#106 Confusing Boundaries for "with image"

closed
nobody
None
5
2011-03-07
2011-03-06
Douglas
No

I'm attempting to overlap some functions that don't work well with pm3d. For instance, it seems that when people want to combine pm3d maps (effectively plot with image) with any other plot, there are all sorts of contortions. For isntance, some "plot" types just don't work with "splot". However, I get unexpected results! Why does this script do everything like I expected but then draws the function and the image as if the borders don't exist? Your input would be greatly appreciated. Check this out:

unset xtics
unset ytics
unset clip
set size ratio -1
set offsets -1,-1,-1,-1
set style line 10 lt 2 lc rgb "white"
set style line 11 lw 1 lt 1 lc rgb "white"
#set palette rgbformulae 33,13,10

h(x) = (0.67-0.82*x)
s(x) = 1
v(x) = (x<0.8?1.0:1-(x-0.8)/(1-0.8))
set palette model HSV functions h(gray),s(gray),v(gray)

#set pm3d map corners2color c1
set title 'Bulk State E=0.37t>>{/Symbol D}{/Symbol e}_0'
set xrange [-6*pi/(3.0):6*pi/(3.0)]
set yrange [-3*pi/(sqrt(3)):3*pi/(sqrt(3))]
#set label 'K' at first 4*pi/(3.0), 0 center front
#set label "K'" at first 2*pi/(3.0), 2*pi/(sqrt(3)) center front
set arrow from first 4*pi/(3.0), 0 to 2*pi/(3.0), 2*pi/(sqrt(3)) ls 10 nohead front
set arrow from first 2*pi/(3.0), 2*pi/(sqrt(3)) to -2*pi/(3.0), 2*pi/(sqrt(3)) ls 10 nohead front
set arrow from first -2*pi/(3.0), 2*pi/(sqrt(3)) to -4*pi/(3.0), 0 ls 10 nohead front
set arrow from first -4*pi/(3.0), 0 to -2*pi/(3.0), -2*pi/(sqrt(3)) ls 10 nohead front
set arrow from first -2*pi/(3.0), -2*pi/(sqrt(3)) to 2*pi/(3.0), -2*pi/(sqrt(3)) ls 10 nohead front
set arrow from first 2*pi/(3.0), -2*pi/(sqrt(3)) to 4*pi/(3.0), 0 ls 10 nohead front

set arrow from first 4*pi/(3.0), 0 to 6*pi/(3.0), 0 ls 10 nohead front
set arrow from first 2*pi/(3.0), 2*pi/(sqrt(3)) to 3*pi/(3.0), 3*pi/(sqrt(3)) ls 10 nohead front
set arrow from first -2*pi/(3.0), 2*pi/(sqrt(3)) to -3*pi/(3.0), 3*pi/(sqrt(3)) ls 10 nohead front
set arrow from first -4*pi/(3.0), 0 to -6*pi/(3.0), 0 ls 10 nohead front
set arrow from first -2*pi/(3.0), -2*pi/(sqrt(3)) to -3*pi/(3.0), -3*pi/(sqrt(3)) ls 10 nohead front
set arrow from first 2*pi/(3.0), -2*pi/(sqrt(3)) to 3*pi/(3.0), -3*pi/(sqrt(3)) ls 10 nohead front

a = 1.0
energy = 0.37
t = 1.0
kx(theta) = cos(theta)*(2*1.0/cos(3*theta)*( sqrt(3+2*energy*cos(3*theta)/t)-sqrt(3))/a)
ky(theta) = sin(theta)*(2*1.0/cos(3*theta)*( sqrt(3+2*energy*cos(3*theta)/t)-sqrt(3))/a)
kpx(theta) = cos(theta)*(-2*1.0/cos(3*theta)*( sqrt(3-2*energy*cos(3*theta)/t)-sqrt(3))/a)
kpy(theta) = sin(theta)*(-2*1.0/cos(3*theta)*( sqrt(3-2*energy*cos(3*theta)/t)-sqrt(3))/a)

k(theta) = (2*1.0/cos(3*theta)*( sqrt(3+2*energy*cos(3*theta)/t)-sqrt(3))/a)
kp(theta) = (-2*1.0/cos(3*theta)*( sqrt(3-2*energy*cos(3*theta)/t)-sqrt(3))/a)

plot '-' matrix using ($2*4*pi/(3.0)/100.0-6*pi/(3.0)):($1*2*pi/(sqrt(3))/100.0-3*pi/(sqrt(3))):(abs($3)) w image notitle, \ '+' using (kx($1)+2*pi/(3*a)):(ky($1)+2*pi/(sqrt(3)*a)) w l ls 11 notitle,\ '+' using (kx($1)+-4*pi/(3*a)):(ky($1)+0) w l ls 11 notitle,\ '+' using (kx($1)+2*pi/(3*a)):(ky($1)+-2*pi/(sqrt(3)*a)) w l ls 11 notitle, \ '+' using (kpx($1)+4*pi/(3*a)):(kpy($1)+0) w l ls 11 notitle,\ '+' using (kpx($1)+-2*pi/(3*a)):(kpy($1)+2*pi/(sqrt(3)*a)) w l ls 11 notitle,\ '+' using (kpx($1)+-2*pi/(3*a)):(kpy($1)+-2*pi/(sqrt(3)*a)) w l ls 11 notitle

Data

Discussion

  • Douglas
    Douglas
    2011-03-06

    Whoops, my introduction here was unintelligible. Let me make this clearer:

    I could have made a perfect plot of what you see using pm3d with these commands:

    splot '-' matrix using ($2*4*pi/(3.0)/100.0-6*pi/(3.0)):($1*2*pi/(sqrt(3))/100.0-3*pi/(sqrt(3))):(abs($3)) notitle, \ '+' using (kx($1)+2*pi/(3*a)):(ky($1)+2*pi/(sqrt(3)*a)):(1) w l ls 11 notitle,\ '+' using (kx($1)+-4*pi/(3*a)):(ky($1)+0):(1) w l ls 11 notitle,\ '+' using (kx($1)+2*pi/(3*a)):(ky($1)+-2*pi/(sqrt(3)*a)):(1) w l ls 11 notitle, \ '+' using (kpx($1)+4*pi/(3*a)):(kpy($1)+0):(1) w l ls 11 notitle,\ '+' using (kpx($1)+-2*pi/(3*a)):(kpy($1)+2*pi/(sqrt(3)*a)):(1) w l ls 11 notitle,\ '+' using (kpx($1)+-2*pi/(3*a)):(kpy($1)+-2*pi/(sqrt(3)*a)):(1) w l ls 11 notitle

    The problem is that I would like to overlap some other functions in a similar plot that aren't supported in pm3d, like "plot w boxes" or "plot w filledcurves". I was hoping "plot w image" would replace my pm3d plot and allow me to use the other plot commands, but it doesn't seem to sense the boundaries quite correctly. I'm hoping this last element can be addressed in some automatic fashion. For instance, it seems in all the examples you have to explicitly set an array parameter by hand.

     
  • Ethan Merritt
    Ethan Merritt
    2011-03-06

    I don't know why your image data is drawn so far outside the box.
    Here's a wild guess: the "set offsets -1,-1,-1,-1" is a really strange command. I would expect it to cause the data to be overflow the box by 1 pixel, but perhaps the "-1" is being scaled to some large number of pixels? Anyhow I suggest that this command is probably not what you want.
    If you attach the data file to this tracker item then I could experiment with it to find out.

    As to your larger problem of mixing 2D and 3D plot styles, the most general answer is to fix the plot borders explicitly and then use "set multiplot". Example is here:
    http://gnuplot.sourceforge.net/demo/margins.html

     
  • Douglas
    Douglas
    2011-03-06

    You're right! That absolutely fixed it! I have no idea what I was thinking with that offests command. I suppose after you copy-and-paste enough times, you get that "copy-of-a-copy" syndrome. lol!

     
  • Ethan Merritt
    Ethan Merritt
    2011-03-07

    • status: open --> closed