3

I need to choose my view angle in \tdplotsetmaincoords{ }{ } (elevation and azimuth) so that my plot ends up looking like the one below. I wish to do this entirely via the view angle, not relabelling the x,y,z coordinates.

enter image description here

\documentclass{article}
\usepackage{tikz}   %TikZ is required for this to work.  Make sure this exists before the next line

%\usepackage{3dplot} %requires 3dplot.sty to be in same directory, or in your LaTeX installation
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview}  %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}

\begin{document}

%Angle Definitions
%-----------------

\tdplotsetmaincoords{60}{110}

%start tikz picture, and use the tdplot_main_coords style to implement the display 
%coordinate transformation provided by 3dplot
\begin{tikzpicture}[scale=5,tdplot_main_coords]

%draw the main coordinate system axes
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\end{tikzpicture}

\end{document}
  • Main coordinates only rotate in 2 directions, which may not be enough for what you wand. See tex.stackexchange.com/questions/254820/… – John Kormylo Aug 6 '15 at 3:26
  • @JohnKormylo There must be a way to specify the 3d view in tikz, starting from the default and applying a general euler angle transformation? – Dipole Aug 6 '15 at 13:51
  • With tikz, yes. With tikz-3dplot, no, unless you use rotated coordinates. – John Kormylo Aug 6 '15 at 14:02
  • @JohnKormylo I do use rotated coordinates, would you mind posting an answer showing what you mean in that case? It could be what I am looking for. – Dipole Aug 6 '15 at 14:04
3

You can specify the actual dimensions (before scaling) for each 3d axis in terms of screen coordinates.

\documentclass{article}
\usepackage{tikz}   %TikZ is required for this to work.  Make sure this exists before the next line

%\usepackage{3dplot} %requires 3dplot.sty to be in same directory, or in your LaTeX installation
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview}  %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}

\begin{document}

%Angle Definitions
%-----------------

\tdplotsetmaincoords{60}{110}

%start tikz picture, and use the tdplot_main_coords style to implement the display 
%coordinate transformation provided by 3dplot

\begin{tikzpicture}[scale=5]
\pgfsetxvec{\pgfpoint{.866cm}{.5cm}}
\pgfsetyvec{\pgfpoint{0cm}{1cm}}
\pgfsetzvec{\pgfpoint{.866cm}{-.5cm}}
%draw the main coordinate system axes
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\end{tikzpicture}

\end{document}

3d axis

Here is a solution using 3dplot.

\documentclass[border=2pt]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{tikz-3dplot}

\begin{document}
\Large
\tdplotsetmaincoords{60}{45}
\begin{tikzpicture}[scale=1in,tdplot_main_coords]
\tdplotsetrotatedcoords{0}{90}{90}
\begin{scope}[tdplot_rotated_coords]
\draw[thick,-latex] (0,0,0) -- (.1,0,0) node[below] {x};
\draw[thick,-latex] (0,0,0) -- (0,.1,0) node[left] {y};
\draw[thick,-latex] (0,0,0) -- (0,0,.1) node[below] {z};
\end{scope}
\end{tikzpicture}

\end{document}

3dplot

  • Thanks appreciate the effort. However, I end up with inconsistencies with all the other points and labels I draw in the 3dplot coordinate systems changing. It really comes down to the fact that I just want to change my view angle! – Dipole Aug 6 '15 at 14:46
  • In that case, start experimenting with rotated coordinates. Note that in my linked answer I wound using \tdplotsetrotatedcoords{90}{90}{-90} in order to get the final circle. – John Kormylo Aug 6 '15 at 14:51
  • Aha! \tdplotsetrotatedcoords{0}{90}{90} – John Kormylo Aug 6 '15 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.