# Having a visability "fog" in the plot

Matplotlib is giving marks a opacity in relation with the distance to the viewer. I would like to achieve something similar in pgfplots.

• Is this possible?

Im already using the point data options for coloring other data in this plot.

• So is it perhaps possible to add a second point data that definse the opacity of the marker (and is mapped in according to the ax that most suitable for the depth)?

Matplotlib:

PGFPlot:

## Python Code - Generating Data and Matplotlib Figure

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
n=50
xs = np.random.randint(0,high=100,size=(n))
ys = np.random.randint(0,high=100,size=(n))
zs = np.random.randint(0,high=100,size=(n))
fig = plt.figure()
ax.scatter(xs, ys, zs, c=zs)
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
sdata = [xs,ys,zs]
np.savetxt('data.csv', np.transpose(sdata), delimiter=',', fmt='%i')
plt.show()


## MWE PGF-Plot

% Using LuaLatex - other Compiler should also work
\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}
\begin{tikzpicture}
\begin{axis}[width=12cm, height=6cm, view={30}{30},
colormap/viridis,
colorbar,
grid=major]
table[x index=0, y index=1, z index=2, point meta=z, col sep=comma]{data.csv};
\end{axis}
\end{tikzpicture}
\end{document}


## Data-Table if needed

27,81,45
88,92,23
1,89,41
27,43,0
1,96,19
12,84,71
19,53,24
37,46,95
58,85,35
26,48,37
24,55,79
92,15,71
69,39,82
4,52,29
80,88,75
46,67,64
88,18,34
24,97,31
63,20,57
76,89,71
8,31,50
78,57,46
68,15,40
57,29,73
87,43,21
60,74,40
75,32,58
82,95,83
13,48,54
94,58,67
40,44,8
92,76,40
28,59,43
2,91,40
0,96,48
35,39,52
58,7,38
9,53,81
87,39,9
82,28,7
92,21,52
30,29,69
4,94,37
78,94,86
94,58,76
54,89,39
6,68,84
85,37,93
1,68,67
51,8,62


\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}
\begin{tikzpicture}
\begin{axis}[view={30}{30},colormap/viridis,colorbar,grid=major]