# How to draw a coordinate system without grid or scale?

I hope to draw coordinate system for three-dimensional space that has a line through the origin as the above picture using TikZ as similar as possible. But the examples of graphs I found have grids or scales. Is there a useful code to draw this?

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

%\psset{algebraic,arrows=<->} ? failed... what should I put?

\end{tikzpicture}
\end{document}


[still it's hard to place a desired angle and length....]

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
axisline/.style={very thick,-stealth},
rotate around y=10,
]
\draw [axisline] (-3,0,0) -- (3,0,0) node[right]{$x_2$};
\draw [axisline] (0,-3,0) -- (0,3,0) node[left]{$x_3$};

\draw [axisline, cyan] (0,0,1) -- (1,1,2) node[right]{$x_k$};
\draw [axisline] (0,0,1) -- (1,1,2) node[right]{$v$};

\end{tikzpicture}
\end{document}


\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[axisline/.style={very thick, -stealth}]

\draw[axisline] (-3,1,0)--(3,-1,0) node[right]{$x_2$};
\draw[axisline] (0,-2.5,0)--(0,3,0) node[above]{$x_3$};
\draw[axisline] (0,0,-3)--(0,0,4) node[below left]{$x_1$};
\draw[cyan] (1, 3, 0)--(-1, -3, 0);
\draw[axisline] (0,0,0)--(0.4,1.2,0) node[right]{$v$};

\end{tikzpicture}
\end{document}


TikZ allows you to specify coordinates in three dimensions, so just draw some lines.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
axisline/.style={very thick,-stealth},
rotate around y=10,
]
\draw [axisline] (-3,0,0) -- (3,0,0) node[right]{$x_1$};
\draw [axisline] (0,-3,0) -- (0,3,0) node[right]{$x_2$};
\draw [axisline] (0,0,-3) -- (0,0,3) node[right]{$x_3$};

\draw [cyan] (-2,-2,-2) -- (2,2,2);
\draw [thick,-latex] (0,0,0) -- (1,1,1) node[right]{$\mathbf{v}$};
\end{tikzpicture}
\end{document}


You can adapt it from Drawing Axis Grid in 3D with Custom Unit Vectors:

## Notes:

• I left in the code to also \DrawCoordinateGrid but have commented out the call to this.

## Code:

\documentclass{standalone}

\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{3d}

\makeatletter
%% Apply fix from https://tex.stackexchange.com/questions/48774/drawing-axis-grid-in-3d-with-custom-unit-vectors
\tikzoption{canvas is xy plane at z}[]{%
\def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
\def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
\def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
\tikz@canvas@is@plane
}
\makeatother

\NewDocumentCommand{\DrawCoordinateGrid}{O{} m m m m m m}{%
\def\XGridMin{#2}
\def\XGridMax{#3}
\def\YGridMin{#4}
\def\YGridMax{#5}
\def\ZGridMin{#6}
\def\ZGridMax{#7}
%
\begin{scope}[canvas is xy plane at z=0, thick, red]
\draw [#1] (\XGridMin,\YGridMin) grid (\XGridMax,\YGridMax);
\end{scope}
\begin{scope}[canvas is yz plane at x=0, thin, blue]
\draw [#1] (\YGridMin,\ZGridMin) grid (\YGridMax,\ZGridMax);
\end{scope}
\begin{scope}[canvas is xz plane at y=0, thin, orange]
\draw [#1] (\XGridMin,\ZGridMin) grid (\XGridMax,\ZGridMax);
\end{scope}
}%

\NewDocumentCommand{\DrawCoordinateAxis}{O{} m m m m m m}{%
\def\XAxisMin{#2}
\def\XAxisMax{#3}
\def\YAxisMin{#4}
\def\YAxisMax{#5}
\def\ZAxisMin{#6}
\def\ZAxisMax{#7}
%
\begin{scope}[thin, gray, -latex]
\draw [#1] (\XAxisMin,0,0) -- (\XAxisMax,0,0) node [below left] {$x$};
\draw [#1] (0,\YAxisMin,0) -- (0,\YAxisMax,0) node [right] {$y$};
\draw [#1] (0,0,\ZAxisMin) -- (0,0,\ZAxisMax) node [above] {$z$};
\end{scope}
}%

\begin{document}
\begin{tikzpicture}[
x={(1.0cm,0.0cm)}, y={(0.0cm,1.0cm), z={(-0.5cm,-0.1cm)}}% All grids are ok
]

%\DrawCoordinateGrid{0}{4}{0}{4}{0}{4}
\DrawCoordinateAxis[thick, black]{-2}{5}{-2}{5}{-2}{5}

\draw [thin, blue]     (-2,-3,-5) -- (2,3,5);
\draw [ultra thick, red, -stealth] (0,0,0) -- (1,1.5,2.5);
\end{tikzpicture}
%
\begin{tikzpicture}[
x={(-0.5cm,-0.5cm)}, y={(0.9659cm,-0.25882cm)}, z={(0cm,1cm)}% x-y grid is wacky
]

%\DrawCoordinateGrid{0}{4}{0}{4}{0}{4}
\DrawCoordinateAxis[thick, black]{-2}{5}{-2}{5}{-2}{5}

\draw [thin, blue]     (-2,-3,-5) -- (2,3,5);
\draw [ultra thick, red, -stealth] (0,0,0) -- (1,1.5,2.5);
\end{tikzpicture}
\end{document}

• For the record: Jake's patch is now incorporated in v3.1 of TikZ. Jan 15, 2019 at 19:03