Drawing a plane on a cartesian plane using gnuplot -
i'm trying reproduce figure i've found on linear algebra book using gnuplot. original image
you can see intersection between 2 planes described 2 equations:
- 2u + v + w = 5
- 4u - 6v = -2.
i suppose in order plot first equation using gnuplot have transform in form:
splot 5 - 2*x - y
where u -> x; v -> y , w -> z free variable. result different expected. clue?
the approach outline makes sense, however, results may far expect.
propose draw single lines, using arrow
function in gnuplot.
example generate plot similar 1 showed (only 1 plane, though):
set term gif set output "demo_plane.gif" # define axis limits: xmax = 6.5 xmin = -1.5 ymax = 8.5 ymin = -1.5 zmax = 5.5 zmin = -0.5 set xrange [xmin:xmax] set yrange [ymin:ymax] set zrange [zmin:zmax] # remove original axis unset border unset xtics unset ytics unset ztics # define data points: x1 = 3.0 y1 = -1.0 z1 = 0.0 x2 = -1.0 y2 = 7.0 z2 = 0.0 x3 = -3.0 y3 = 7.0 z3 = 4.0 x4 = 1.0 y4 = -1.0 z4 = 4.0 # define 'arrow' without head: set arrow 1 x1,y1,z1 \ x2,y2,z2 nohead set arrow 2 x2,y2,z2 \ x3,y3,z3 nohead set arrow 3 x3,y3,z3 \ x4,y4,z4 nohead set arrow 4 x4,y4,z4 \ x1,y1,z1 nohead # draw new axis manually (again, using arrow): set arrow 5 0,0,0 \ 6,0,0 set arrow 6 0,0,0 \ 0,6,0 set arrow 7 0,0,0 \ 0,0,5 # annotate axis labels: set label "u" @ 6.25,0,0 set label "v" @ 0,6.25,0 set label "w" @ 0,0,5.25 # plot not show when empty, include dummy plot command: set parametric splot x1, y1, z1 not
with little rotation figure this:
Comments
Post a Comment