# 3 dimension plots with larger z axis and all the values show up on ticks

I am trying to build a 3 dimension graph using the following code.

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\begin{figure} [H]
\centering
\begin{tikzpicture} [scale=0.8]
\begin{axis}[
view = {5}{8},
grid=both,
legend cell align=left,
xticklabels = {10,20,30,40,50,60,70,80,90,100,110},
yticklabels ={0.03,0.05,0.07,0.09,0.11,0.13,0.23,0.33,0.43,0.53},
zticklabels = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1},
xtick={1,2,3,4,5,6,7,8,9,10,11},
ytick={1,2,3,4,5,6,7,8,9,10},
tick label style={font=\tiny},
legend pos=north east,
legend columns = 4,
y tick label style={rotate=90},
ylabel=distinctness,
xlabel=Dimension,
zlabel=silhouette coefficient,
y label style={rotate=57},
]
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}


There are some issues with it, may be many, you can suggest what other changes can I make so that the plot is more illustrative. Issues that I know of but don't know how to solve:

1. How can I increase the length of y-axis so that all the ticks and labels are clearly readable like the labels of x-axis
2. How can I show all the ticks for z-axis, I wrote zticklabels = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1} in my code, but the plot does not show all the values. What is going wrong here?

3. What is the meaning of view attribute? I know changing the values changes the orientation of plot along the z-axis. But what I don't understand is how it works, means, I don't know what value of views will bring what kind of effect?

I will appreciate any suggestion that you can provide. Thanks.

-
Welcome to TeX.sx! As a new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. –  Torbjørn T. Jan 25 '12 at 17:06
IMHO: this kind of graph should not be done in 3D, even when the view is at the correct position. The view attribute tells tikz where the "camera" is located in 3D space (spherical coordinates, if I'm not mistaken). The problem is that for points drawn floating in a 3D axis it's hard to see what the values on the axes are. I would suggest you use several stacked (2D) surface plots, perhaps using opacity. Even this could become cluttered though, since there are so many surfaces. Perhaps it would be best to try a singe (3D) surface plot of all your data? Note that this is purely an opion. –  romeovs Jan 25 '12 at 18:10

• Point 1: use the key plot box ratio.
• Point 2: a workaround is to give explicitly the ticks as you did for x and y axis. However, they are not all there, I need to dig more in the manual.
• Suggestion: use the sloped key to avoid the need to give an explicit angle to the rotation of the y label (that value might change with other views).

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
plot box ratio = 1 3 1,
view = {5}{8},
grid = both,
xticklabels = {10,20,30,40,50,60,70,80,90,100,110},
yticklabels = {0.03,0.05,0.07,0.09,0.11,0.13,0.23,0.33,0.43,0.53},
zticklabels = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1},
xtick = {1,2,3,4,5,6,7,8,9,10,11},
ytick = {1,2,3,4,5,6,7,8,9,10},
ztick = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1},
tick label style = {font=\tiny},
y tick label style = {rotate=90},
xlabel = Dimension,
ylabel = distinctness,
zlabel = silhouette coefficient,
y label style = sloped,
]

• Point 3: In the following image, different values of the key view.