0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

gnuplot 3D plot

Last updated at Posted at 2021-01-06

概要

出力
for z=0,2{
for y=0,2{
for x=0,2{
write() x, y ,z, x+y+z
}}}なるデータファイル

data.csv
# x, y, z, f(x,y,z)=x+y+z
# 1st black Z=0
# 1st set
0, 0, 0, 0 #1st line
1, 0, 0, 1 #2nd line
2, 0, 0, 2 #3rd line

# 2nd set
0, 1, 0, 1
1, 1, 0, 2
2, 1, 0, 3

# 3rd set 
0, 2, 0, 2
1, 2, 0, 3
2, 2, 0, 4


# 2nd block Z=1
0, 0, 1, 1
1, 0, 1, 2
2, 0, 1, 3

0, 1, 1, 2
1, 1, 1, 3
2, 1, 1, 4

0, 2, 1, 3
1, 2, 1, 4
2, 2, 1, 5


# 3rd block Z=2
0, 0, 2, 2
1, 0, 2, 3
2, 0, 2, 4

0, 1, 2, 3
1, 1, 2, 4
2, 1, 2, 4

0, 2, 2, 4
1, 2, 2, 5
2, 2, 2, 6

3次元plotする

sp "data.csv" with pm3d

特定の断面表示する

u ($1==0 ? $1: 1/0):2:3 もしく はeveryを使う.

実際的なサンプルコード例

3d.gp
# !/user/bin/gnuplot

# set pm3d
# set pm3d map
set ticslevel 0
# set cbrange[20:120]
set palette define (20 "blue", 60 "white", 120 "red")
# set palette define (0 "navy",1 "blue",2 "dark-violet",3 "red",4 "yellow")

set palette rgbformulae 22, 13, -31
# set palette define (20 "white", 100 "red")
# set grid
set xtics  0.01 font "Times,10" offset 0,-1,0
set ytics  0.01 font "Times,10" offset 1,0,0
set ztics  0.01 font "Times,10" offset 0,0,0
set size ratio 1.0
set key left below

set cblabel "{/Times-New-Roman=10 Temp [℃]}"
set xlabel "{/Times-New-Roman=10 X [M]" offset 0,-1,0
set ylabel "{/Times-New-Roman=10 Y [M]" offset 1,0,0
set zlabel "{/Times-New-Roman=10 Z [M]" offset 0,0,0
set view equal xyz
set cbtics 10 font "Times,10" offset 1,0,0
# set colorbox  user origin 0,0

set format cb "%.2f"


splot for [j=0:100:5] "result/result_05_0.020.txt" every ::: (j*201+0) :: (j*201+200) with pm3d not


set arrow from 0.00,0.00,0.00 to 0.04,0.00,0.00 nohead lw 1 lc black front
set arrow from 0.00,0.04,0.00 to 0.04,0.04,0.00 nohead lw 1 lc black front
set arrow from 0.00,0.00,0.04 to 0.04,0.00,0.04 nohead lw 1 lc black front
set arrow from 0.00,0.04,0.04 to 0.04,0.04,0.04 nohead lw 1 lc black front

set arrow from 0.00,0.00,0.00 to 0.00,0.00,0.04 nohead lw 1 lc black front
set arrow from 0.04,0.00,0.00 to 0.04,0.00,0.04 nohead lw 1 lc black front
set arrow from 0.04,0.04,0.00 to 0.04,0.04,0.04 nohead lw 1 lc black front
set arrow from 0.00,0.04,0.00 to 0.00,0.04,0.04 nohead lw 1 lc black front

set arrow from 0.00,0.00,0.04 to 0.00,0.04,0.04 nohead lw 1 lc black front
set arrow from 0.04,0.00,0.04 to 0.04,0.04,0.04 nohead lw 1 lc black front
set arrow from 0.04,0.00,0.00 to 0.04,0.04,0.00 nohead lw 1 lc black front
set arrow from 0.00,0.00,0.00 to 0.00,0.04,0.00 nohead lw 1 lc black front
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?