4

I have three questions:

  1. How can I draw the arrow marks in the picture below?
  2. How can I customize the location of the labels of the axes?
  3. How can I change the axis line style as latex?

Current Code:

\documentclass{article}
\usepackage{pgfplots}

\usetikzlibrary{arrows,decorations.markings}
\pgfplotsset{compat=1.9}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[scale=2, width=8cm,axis equal image, xticklabel style={below}, 
        yticklabel style={below}, zticklabel style={left},
        axis line style={very thick, latex-latex},
        x={(-0.6cm,-0.3cm)}, y={(.8cm,0.0cm)}, z={(0cm,.8cm)},
        xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
        axis lines=middle,
        xtick={1}, ytick={1},ztick={1},
        enlargelimits=true,
        clip=true
        ]
        \addplot3[samples y=0,
        smooth, thick, color=blue,
        domain=0:1
        ] ({0},{x},{sqrt(1-x^2)});
        \addplot3[
        samples y=0,
        smooth, thick, color=green,
        domain=0:1
        ] ({x},{0},{sqrt(1-x^2)});
        \addplot3[
        samples y=0,
        smooth, thick, color=red,
        domain=0:1
        ] ({x},{sqrt(1-x^2)},{0});
        \node at (axis cs:1,1,0) {$ C_1 $};
        \node at (axis cs:0,0.8,0.8) {$ C_2 $};
        \node at (axis cs:0.8,0,0.8) {$ C_3 $};
    \end{axis}
\end{tikzpicture}
\end{document}

Output with additional arrows:

Output with additional arrows.

2
  • For the arrows see in the pgfmanual chapter "50.6.1 Arrow Tip Marking". Fpr the axes there are several chapters. You may want to go to "82.5 Advanced: Creating New Axis Systems". Find the manual here: ctan.org/pkg/pgf
    – MS-SPO
    Jun 5 at 14:29
  • 2
    If the sketch you gave is exactly what you need, I'll recommend not to use the axis environment which is too heavy for that simple task. A plain TikZ drawing would allow you to place an arrow on the middle of your curves (using decorations.markings library).
    – SebGlav
    Jun 5 at 14:39

2 Answers 2

3

If you only need to draw what you show, it will be easier IMHO to do it with plain TikZ instead of PGFPlots. You'll need 3d and perspective libraries for this.

For example:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{3d}           % canvas is... options
\usetikzlibrary{perspective}  % 3d view
\usetikzlibrary{arrows.meta,decorations.markings} % arrow and decorations

\tikzset
{% this style creates an arrow like the one you draw in the middle of a path
   ->-/.style={decoration={markings,mark=at position 0.5 with {\arrow{Straight Barb}}},
               postaction={decorate}}
}

\begin{document}
\begin{tikzpicture}[line join=round,line cap=round,3d view={120}{30},scale=4]
\draw[-latex] (-0.2,0,0) -- (1.2,0,0) node[left]  {$x$}; % <-- here you can change the label position
\draw[-latex] (0,-0.2,0) -- (0,1.2,0) node[right] {$y$};
\draw[-latex] (0,0,-0.2) -- (0,0,1.2) node[above] {$z$};
\node[below]       at (1,0,0) {$1$};
\node[below]       at (0,1,0) {$1$};
\node[above right] at (0,0,1) {$1$};
\draw[canvas is xy plane at z=0,red  ,->-] (1,0) arc (0:90:1) node[black,midway,below] {$C_1$};
\draw[canvas is yz plane at x=0,blue ,->-] (1,0) arc (0:90:1) node[black,midway,right] {$C_2$};
\draw[canvas is zx plane at y=0,green,->-] (1,0) arc (0:90:1) node[black,midway,left]  {$C_3$};
\end{tikzpicture}
\end{document}

enter image description here

3

Edit (1): Please, one problem for question! But seems that the following (simplified code) solve most of your problems.

Edit (2): added are tick style, tick label style and axis on top,

enter image description here

For above image is defined style ->- (you can select other name), which define by use of the decorations.markings library:

  • arrows positioned in the middle of curve.
  • labels of curves
\documentclass[border=3.141592mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta,
                decorations.markings}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{tikzpicture}[
         > = {Straight Barb[scale=1.2]},
->-/.style args = {#1/#2}{decoration={markings,
              mark=at position .5 with {\arrow[very thick]{>};
              \path[draw=none] (0mm,1mm) -- (0mm,-5mm) node {$#1$};
                                        }
                         },
              postaction = {decorate}
              }
                    ]
\begin{axis}[
  axis lines=center,
  axis on top,
  axis line style = {semithick, Straight Barb-Straight Barb},
x={(-30mm,-15mm)}, y={(40mm,-10mm)}, z={(0,40mm)},
xtick={1},  ytick={1},ztick={1},
tick style = {tickwidth=3mm, thick, black},
xlabel=$x$, ylabel=$y$, zlabel=$z$,
tick label style = {inner sep=2mm},
xmin=-0.2,  ymin=-0.2,  zmin=-0.2,
xmax= 1.2,  ymax=1.2,   zmax=1.2,
%
samples y=0, samples=101, domain=1:0,
]
\addplot3[->-=C_2/2, thick, color=blue] ({0},{x},{sqrt(1-x^2)});
\addplot3[->-=C_3/3, domain=0:1,
                     thick, color=teal] ({x},{0},{sqrt(1-x^2)});
\addplot3[->-=C_1/1, thick, color=red]  ({x},{sqrt(1-x^2)},{0});
\end{axis}
\end{tikzpicture}
\end{document}

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.