0

I'm trying to plot the following 3 intersecting planes:

x + 2y + 4z = 7

2x + 3y + 3z = 1

3x + 7y + 2z = -11

To add emphasis, I wanted to include some headless arrows along the intersection of each pair of planes and a small sphere to indicate the intersection point. But for some reason the planes themselves seem to be out of alignment with the axes. From the equations I can easily find the coordinate of the intersection point, find the coordinates of the edges of the lines that run along the intersection of each pair of planes and if needed find the parametric equation of the lines. But so far when I plot the lines as arrows from the edges of my plot or the intersection as a circle, the planes seem to be wrongly positioned within the coordinates. I can see that the circle or the lines are positioned correctly, but the planes themselves seem to have been shifted. What could be causing this? Am I entering the equations wrong? Maybe the shift of the xy plane moves things around? I think it must be something obvious I'm just not seeing. I find it quite puzzling.

reset

samps = 500

set samples samps,samps
set isosamples samps,samps

f(x,y) = 7/4 - x/4 - y/2
set table $Data01
   splot f(x,y)
unset table

g(x,y) =  1/3 - 2/3*x - y
set table $Data02
   splot g(x,y)
unset table

h(x,y) = -11/2 - 3/2*x - 7/2*y
set table $Data03
   splot h(x,y)
unset table

Zmin = 1.0
Zmax = 3.5

set xrange [-1.2:0.5]
set yrange [-4:0]
set zrange [Zmin:Zmax]
set hidden3d

set xlabel 'x'
set ylabel 'y'
set zlabel 'z'

set xyplane at Zmin
unset xzeroaxis
unset yzeroaxis
unset zzeroaxis

set border 1023-128
set xtics out nomirror
set ytics out nomirror
set ztics out
#set xtics add ('' -4)

Frac(z) = (z - Zmin) / (Zmax - Zmin)

#MyPalette01
Red01(z) = 0
Green01(z) = 255*256
Blue01(z) = int(255*Frac(z))
MyPalette01(z) = Red01(z) + Green01(z) + Blue01(z)

#MyPalette02
Red02(z) = 255*256*256
Green02(z) = int(165*Frac(z))*256
Blue02(z) = 0
MyPalette02(z) = Red02(z) + Green02(z) + Blue02(z)

# MyPalette03
Red03(z)   = int(-95*Frac(z)+255)*256*256
Green03(z) = int(32*Frac(z))*256
Blue03(z)  = int(-15*Frac(z)+255)
MyPalette03(z) =  Red03(z) + Green03(z) + Blue03(z) 

#Red03(z)   = int(255*Frac(z))*256*256
#Green03(z) = int(255*Frac(z))*256
#Blue03(z)  = int(255*Frac(z))

set object circle at -1,-2,3 size 0.05 front
unset key

set pm3d
set pm3d lighting primary 0.5 specular 0.6
set pm3d ftriangles
set style fill transparent solid 0.75 noborder
set pm3d depthorder
unset colorbox

set view 68, 126

splot $Data01 u 1:2:3:(MyPalette01($3)) w l lc rgb var notitle, \
      $Data02 u 1:2:3:(MyPalette02($3)) w l lc rgb var notitle, \
      $Data03 u 1:2:3:(MyPalette03($3)) w l lc rgb var notitle

I found how to set multiple styles for each plane in here: Gnuplot 5.2 splot: Multiple pm3d palette in one plot call

And this is how it looks:

Any Ideas?Weird planes

  • 2
    Remember that gnuplot uses integer arithmetic. So 1/3 = 0 and 11/2 = 5, etc. Place decimal points after your (integer) numerical constants to force floating point arithmetic. 1./3. = 0.3333 11./2/ = 5.5 and so on. – Ethan Dec 27 '20 at 21:15
  • I should have remembered from making the same mistake in Fortran. Bless your soul. I knew it would be something simple. – Ottmar Schaub Dec 28 '20 at 06:52

0 Answers0