1

I have this 3D plot in pgf but I have an issue with scaling. The points s_3 and s_4 should have the same length but they appear not: s_3 appears bigger than s_4 why?

\documentclass{standalone} % You can use article, report, or standalone \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} % Ensure compatibility with newer pgfplots features \begin{document} \begin{tikzpicture} \begin{axis}[ view={120}{30}, % Adjust the view angle axis lines=middle, xlabel={$ \phi_3(t) $}, ylabel={$ \phi_1(t) $}, zlabel={$ \phi_2(t) $}, xmin=-2, xmax=2, ymin=-2, ymax=2, zmin=-2, zmax=2, xtick=\empty, ytick=\empty, ztick=\empty, grid=major, width=14cm, height=14cm, axis line style={thick,->,>=latex}, % Add arrows to the positive axes axis equal, unit vector ratio=1 1 1, scale=1.2 ] % Plot the points \addplot3[only marks, blue, mark=*] coordinates { (0, 1.414, 0) % s1 = (sqrt(2), 0, 0) (0, 0, 1.414) % s2 = (0, sqrt(2), 0) (1, 0, -1.414) % s3 = (0, -sqrt(2), 1) (1, 1.414, 0) % s4 = (sqrt(2), 0, 1) }; % Labels for the points \node at (axis cs: 0, 1.414, 0.6) [blue, anchor=north] {$\mathbf{s}_1$}; \node at (axis cs: 0, 0, 1.6) [blue, anchor=west] {$\mathbf{s}_2$}; \node at (axis cs: 1, 0, -1.6) [blue, anchor=east] {$\mathbf{s}_3$}; \node at (axis cs: 0.7, 1.2, 0) [blue, anchor=north west] {$\mathbf{s}_4$}; \draw[ultra thick, blue] (axis cs:0,0,0) -- (axis cs: 0, 1.414, 0); \draw[ultra thick, blue] (axis cs:0,0,0) -- (axis cs: 0, 0, 1.414); \draw[ultra thick, blue] (axis cs:0,0,0) -- (axis cs: 1, 0, -1.414); \draw[ultra thick, blue] (axis cs:0,0,0) -- (axis cs: 1, 1.414, 0); \node at (axis cs: 0, 0.7, 0.2) {$\sqrt{2}$}; \node at (axis cs: 0, 0.2, 0.8) {$\sqrt{2}$}; \node at (axis cs: 0.2, -0.1, -1.2) {$\sqrt{3}$}; \node at (axis cs: 0.7, 0.6, 0) {$\sqrt{3}$}; \end{axis} \end{tikzpicture} \end{document} 

enter image description here

2
  • 1
    Including a screenshot might attract more solutions ... Commented Oct 25, 2024 at 11:10
  • 1
    I edited the question to add a screenshot. Commented Oct 28, 2024 at 13:06

1 Answer 1

3
\documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ width=14cm, axis equal, view={120}{30}, axis lines=middle, ticks=none, xlabel=x, ylabel=y, zlabel=z, xmin=-2, xmax=2, ymin=-2, ymax=2, zmin=-2, zmax=2, axis line style={thick,-latex}, ] \newcommand{\drawvec}[4]{ \draw[#4] (0,0,0) -- ({#1},{#2},{#3}); \draw[#4, -, thin, densely dotted] ({#1},0,0) -- ({#1},{#2},0) -- (0,{#2},0) ({#1},{#2},0) -- ({#1},{#2},{#3}); } \drawvec{0}{sqrt(2)}{0}{blue, ->, ultra thick} \drawvec{0}{0}{sqrt(2)}{blue, ->, ultra thick} \drawvec{1}{0}{-sqrt(2)}{blue, ->, ultra thick} \drawvec{1}{sqrt(2)}{0}{blue, ->, ultra thick} \drawvec{1}{1}{1}{red, ->, ultra thick} \end{axis} \end{tikzpicture} \end{document} 

3D coordinate system with some 3D vectors

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.