# Surface plot with coordinates in pgf

Is it possible to draw a three dimensional surface using coordinates instead of formulas?

MWE so far:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}
{(23, 75, 13000) (23, 80, 14000) (23, 85, 15000) (23, 90, 16000) (23, 95, 17000) (28, 65, 7000) (28, 70, 8000) (28, 75, 9000) (28, 80, 10000) (28, 85, 11000) (28, 90, 12000) (28, 95, 13000)};
\end{axis}
\end{tikzpicture}

\end{document}

-

Yes this is possible. According to the manual you need to read in a datafile with a blank line between y values. Even though you asked for coordinates, I guess it is not really handy to type them in code if you can read a file instead,

0 0 0
1 0 1
2 0 1.5

0 1 0.5
1 1 2
2 1 0.7


Then you can read in this file

\documentclass{article}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}

\end{document}


-

I have recently used this kind of plot, almost in the same way as in Martin H answer. The difference was the use of the table command instead of file. This way you can have data formatted like this, with several data columns

-3  0     0.2   0.20  0.2
-3  0.25  0.57  0.71  0.71
-3  0.5   0.73  0.78  0.83
-3  0.75  0.85  0.88  0.91
-3  0.95  0.97  0.98  0.98

-2  0     0.29  0.29  0.29
-2  0.25  0.59  0.64  0.68
-2  0.5   0.73  0.78  0.80
-2  0.75  0.85  0.88  0.90
-2  0.95  0.96  0.98  0.98

-1  0     0.42  0.42  0.42
-1  0.25  0.65  0.65  0.65
-1  0.5   0.74  0.79  0.79
-1  0.75  0.87  0.89  0.90
-1  0.95  0.97  0.97  0.98

0  0      0.7   0.71  0.71
0  0.25   0.75  0.76  0.74
0  0.5    0.82  0.81  0.82
0  0.75   0.89  0.90  0.90
0  0.95   0.97  0.97  0.97

1  0      0.91  0.91  0.91
1  0.25   0.90  0.91  0.91
1  0.5    0.91  0.91  0.91
1  0.75   0.93  0.93  0.93
1  0.95   0.95  0.95  0.95


Then, just invoke the addplot like this

\addplot3[scatter,surf,z buffer=sort]
table[x index=0,y index=1,z index=3] {myfile.dat};


The data column is selected with the z index= key. (using pgfplots version 1.5.1)

-

Yes you can, for example

\begin{tikzpicture}

\begin{axis}[%
view={64}{26},
width=6cm,
height=6cm,
scale only axis,
xmin=1, xmax=11,
xmajorgrids,
ymin=1, ymax=11,
ymajorgrids,
zmin=0, zmax=1,
zmajorgrids,
axis lines=left,
grid=major]

surf,
z buffer=sort,
colormap/jet,
draw=black]
coordinates{
(1,1,0.003728147889839)(1,2,0.118017202190155)(1,3,0.221673852437962)(1,4,0.312437513085561)(1,5,0.387194230510164)(1,6,0.440742582360006)(1,7,0.463468053018881)(1,8,0.445530073971387)(1,9,0.369961896202074)(1,10,0.223133553545923)(1,11,0.00374437935895966)

(2,1,0.0853329617250701)(2,2,0.220790622984148)(2,3,0.34459776553185)(2,4,0.454212891948978)(2,5,0.545783375378684)(2,6,0.613545573836728)(2,7,0.64680888751547)(2,8,0.636747129886029)(2,9,0.565721840578472)(2,10,0.417666014278492)(2,11,0.190999599472948)

(3,1,0.155342172376848)(3,2,0.309822662999299)(3,3,0.451065683608965)(3,4,0.575854462426754)(3,5,0.679376623358995)(3,6,0.754507795686183)(3,7,0.791577077817509)(3,8,0.784476347356156)(3,9,0.716691470085854)(3,10,0.569332748623411)(3,11,0.337025756909602)

(4,1,0.212516702294838)(4,2,0.383413316206777)(4,3,0.538530906131096)(4,4,0.673799219102328)(4,5,0.783219850668224)(4,6,0.860688297993034)(4,7,0.897887375321675)(4,8,0.890237828914889)(4,9,0.823602501614381)(4,10,0.677448189094015)(4,11,0.441428715403078)

(5,1,0.254983315520193)(5,2,0.438736497199194)(5,3,0.603204205115548)(5,4,0.743748933219212)(5,5,0.855393671944023)(5,6,0.932369802409294)(5,7,0.967098925205277)(5,8,0.956526922577927)(5,9,0.887418134294991)(5,10,0.740716702498437)(5,11,0.502904188748348)

(6,1,0.279580042690462)(6,2,0.471776755427732)(6,3,0.641183297852209)(6,4,0.78372415732377)(6,5,0.894763524461618)(6,6,0.96932619948012)(6,7,1)(6,8,0.983845729330807)(6,9,0.90893190033403)(6,10,0.759475982572268)(6,11,0.520322817339646)

(7,1,0.284834740456549)(7,2,0.481516089344792)(7,3,0.652805651854105)(7,4,0.794573169483346)(7,5,0.902690136956274)(7,6,0.972631989838986)(7,7,0.997044798062995)(7,8,0.972934675632469)(7,9,0.889610739961573)(7,10,0.733952138770354)(7,11,0.493118988206001)

(8,1,0.260000140257993)(8,2,0.458905596305152)(8,3,0.630100484670537)(8,4,0.769792184032965)(8,5,0.873966940512854)(8,6,0.938215110739908)(8,7,0.955181067976377)(8,8,0.922095282456408)(8,9,0.828947405628713)(8,10,0.666520564592709)(8,11,0.425421376290589)

(9,1,0.20615424917805)(9,2,0.405132944780996)(9,3,0.574423435029049)(9,4,0.710286034681503)(9,5,0.808767108505734)(9,6,0.865736341444958)(9,7,0.873670136506091)(9,8,0.829968574292227)(9,9,0.72694189733545)(9,10,0.558708262360719)(9,11,0.319605261982135)

(10,1,0.121089587416419)(10,2,0.318276996185098)(10,3,0.483962856064423)(10,4,0.614131829616855)(10,5,0.705164299228662)(10,6,0.752989955378732)(10,7,0.749403083481442)(10,8,0.694354027683535)(10,9,0.582577966759085)(10,10,0.412436427217246)(10,11,0.178613291865232)

(11,1,0.00373165433961165)(11,2,0.197146575595497)(11,3,0.356969085894562)(11,4,0.479350121385376)(11,5,0.560843124717293)(11,6,0.596526001852086)(11,7,0.579610492247863)(11,8,0.513717740520685)(11,9,0.39754877669582)(11,10,0.229574845227007)(11,11,0.00374273924535296)

};

\end{axis}
\end{tikzpicture}


generates this

-