gnuplot / plotpm3d (E)
not so FAQ |
3-Dim Plot with a Color-Map (pm3d)How do I draw a colored 3D figure ?[ver.4] ONLY ! Gnuplot draws 3D figures with lines and / or points, in addition, gnuplot> set xrange [-2:2] gnuplot> set yrange [-2:2] gnuplot> set pm3d gnuplot> splot exp(-x*x)*exp(-y*y) ![]() You can choose color or gray-scale by the terminal option of gnuplot> set term postscript eps enhanced color gnuplot> set output "color.eps" gnuplot> replot gnuplot> set term postscript eps enhanced monochrome gnuplot> set output "mono.eps" gnuplot> replot ![]() ![]() I want to draw colors for contours.[ver.4] ONLY ! A contour map of gnuplot is shown by lines. The colored contour by pm3d gnuplot> set pm3d at b gnuplot> set ticslevel 0.8 gnuplot> set isosample 40,40 gnuplot> splot x*x*exp(-x*x)*y*y*exp(-y*y) ![]() With pm3d, it is very easy to see the bottom surface in the 2D plot. gnuplot> set pm3d map gnuplot> splot x*x*exp(-x*x)*y*y*exp(-y*y) ![]() Pseudo 3D Bar graph Since gnuplot cannot draw a 3D-bar graph, we need a little trick # X Y Z 0.0 0.0 2.0 0.0 1.0 3.5 1.0 0.0 1.0 1.0 1.0 3.0 The first line means Z=2 when 0< X <1, 0< Y <1, and ![]() Now we expand the data with some programs/tools. See the figure # X Y Z 0.0 0.0 2.0 0.0 1.0 2.0 0.0 1.0 3.5 0.0 2.0 3.5 1.0 0.0 2.0 1.0 1.0 2.0 1.0 1.0 3.5 1.0 2.0 3.5 1.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 3.0 1.0 2.0 3.0 2.0 0.0 1.0 2.0 1.0 1.0 2.0 1.0 3.0 2.0 2.0 3.0 Once you prepare your data in such a way, we just depict gnuplot> set hidden3d gnuplot> splot "test.dat" with lines ![]() [ver.4] ONLY ! When your gnuplot is ver.4, a funcy figure can be made with pm3d. gnuplot> set pm3d gnuplot> splot "test.dat" with pm3d ![]() |