4

Found this coordinate plane in the forum, I really like it. I would like 4 arrows, 2 on each axis, pointing in all 4 directions instead of 2. Not sure why arrows only point right and up. I have seen this in MANY Cartesian planes.

TIA

enter image description here

Here is the code

\documentclass[tikz]{standalone}
\usepackage{tkz-euclide}

\begin{document} \begin{figure}[h] \begin{tikzpicture} \tkzInit[xmax=6,ymax=6,xmin=-6,ymin=-6] \tkzGrid \tkzAxeXY \draw[ thick,latex-latex] (-1,4) -- (4,-6) node[anchor=south west] {$a$}; % two points for drawing 2x+y=2 \tkzTextabove{Desired Output} \end{tikzpicture} \end{figure} \end{document}

enter image description here

Code for pgfplots coordinate plane

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
  axis lines=middle,
  axis line style={Stealth-Stealth, very thick},
  xmin=-10,xmax=10,ymin=-10,ymax=10,
  xtick distance=1,
  ytick distance=1,
  xlabel=$x$,
  ylabel=$y$,
  title={},
  grid=major,
  grid style={thick,black!50}]
\addplot [Latex-Latex,domain=-5:3,samples=2] {x*2/3} node[right]{$a$};
\end{axis}
\end{tikzpicture}
\end{document}
Zarko
  • 296,517

2 Answers2

4

I suggest you change the distance specification

xtick distance=2,
ytick distance=2,

and to change the font of the tick labels you can use:

xticklabel style={font=\small},
yticklabel style={font=\small},

enter image description here

Code:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}

\begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle, axis line style={Stealth-Stealth, thick}, xmin=-10,xmax=10,ymin=-10,ymax=10, xtick distance=2, ytick distance=2, xlabel=$x$, ylabel=$y$, xticklabel style={font=\small}, yticklabel style={font=\small}, title={}, grid=major, grid style={thin,black!50}] \addplot [Latex-Latex, red, thick, domain=-10:10,samples=2] {x*2/3} node[above left]{$a$}; \end{axis} \end{tikzpicture} \end{document}

Peter Grill
  • 223,288
3
\documentclass[tikz]{standalone}

\usepackage{tkz-base,tkz-euclide}
\begin{document}

\begin{tikzpicture}
   \tkzInit[xmax=6,ymax=6,xmin=-6,ymin=-6]
   \tkzGrid
   \tikzset{xaxe style/.style    =   {>  =   latex,  <->}
   }  
   \tikzset{yaxe style/.style    =   {>          =   latex, < ->}
   }
   \tkzAxeXY
   \tkzDefPoints{-1/4/A,4/-6/B}
   \tkzDrawSegment[red,latex-latex](A,B)
  \tkzText[above](0,6.75){Desired Output}
  \end{tikzpicture}

\end{document}

enter image description here

Alain Matthes
  • 95,075