I am experimenting with Tikz to include graphics in my LaTeX documents. I have made a few 2D and 3D diagrams. One of the diagrams contains a 3D pyramid. I want to place text on the front and side of the pyramid. I managed to place text on the front. Placing text on the side however is a problem for me because it is not in perspective and therefore ruining the 3D experience.
I want the text on the side to be rotated in such a way that it appears to be in the same pane as the side. I could try to rotate the text but then positioning is cumbersome. There must be a better way to do this? Somehow write text on the z-axis instead of in the x/y pane.
I managed to produce something to illustrate what i had in mind. There should be a better way to achieve this. The text is obviously not 3D aware and therefore not in perspective. Also the text is not aware of the figure and with larger texts it runs outside the boundaries of the illustration as it is not contained by the edges.
Any suggestions would be really appreciated. Thank you in advance!
\begin{tikzpicture}[scale=0.5]
\example of my pyramid:
\path coordinate (0) at (0,0,0)
% The base layer
coordinate (A) at (-9,0,9)
coordinate (B) at (9,0,9)
% The middle layer
coordinate (C) at (-6,4,6)
coordinate (D) at (6,4,6)
% The top layer
coordinate (E) at (-3.75,7,3.75)
coordinate (F) at (3.75,7,3.75)
coordinate (G) at (0,12,0)
% 3d effect
% The base layer
coordinate (AA) at (-9,0,-9)
coordinate (BB) at (9,0,-9)
% The middle layer
coordinate (CC) at (-6,4,-6)
coordinate (DD) at (6,4,-6)
% The top layer
coordinate (EE) at (-3.75,7,-3.75)
coordinate (FF) at (3.75,7,-3.75);
% Draw lines between points
\draw (A) -- (B) -- (BB);
\draw (C) -- (D) -- (DD);
\draw (E) -- (F) -- (FF);
\draw (A) -- (G) -- (B);
\draw (G) -- (BB);
% Text added to node positioned at center of segment.
\node at (0,2,7.5) {Base of the pyramid};
\node at (0,5.5,4.875) {Middle section};
\node at (0,9,1.875) {Top of the pyramid};
% Rotated text added to node positioned at center of segment.
\node [rotate=45] at (7.5,2,0) {Base};
\node [rotate=45] at (4.875,5,0) {Middle};
\node [rotate=45] at (1.875,9,0) {Top};
\end{tikzpicture}
xslant
andyslant
but without some code it's difficult to give a good answer.