# how to fix this cartesian plane with tikzpicture?

I would like to modify this Cartesian plane, by drawing the vertical line x = -2 and adding the 0 and the lines as in the figure, but I can not fix them. Could you kindly help me?

\documentclass[margin=20pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots} %%%%%

\usepackage{lxfonts}

\begin{document}
\begin{tikzpicture}[
dot/.style={
circle,fill,draw,minimum size=2mm,inner sep=0
}]

\begin{axis}[
axis equal image,
max space between ticks=20, % This is one way of getting a tick for every integer
ticklabel style={font=\scriptsize},
axis lines = middle,
xmin=-5.5, xmax=5.5, % The range over which the x axis is drawn
ymin=-4.5, ymax=6.0, % The range over which the y axis is drawn
domain=-6:5.5,         % The range over which the function is evaluated
grid=both,
xlabel=$x$, ylabel=$y$
]

\addplot [very thick, blue, smooth] {-(0)*x+1};

\coordinate [label=above right:$0$] t (0.0,0.0);
\draw [color=black,fill=black,fill opacity=1.0] (a) circle (0.15cm);

\coordinate [label=above right:$y=1$] at (-4.0,2.0);

\coordinate [label=above right:$x=-2$] at (-4.0,-3.0);

\end{axis}

\end{tikzpicture}

\end{document}


I added a proposal (and fixed a few minor errors).

\documentclass[margin=20pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{pgfplots} %%%%%
\pgfplotsset{compat=1.16}
%\usepackage{lxfonts}

\begin{document}
\begin{tikzpicture}[
dot/.style={
circle,fill,draw,minimum size=2mm,inner sep=0
}]

\begin{axis}[
axis equal image,
max space between ticks=20, % This is one way of getting a tick for every integer
ticklabel style={font=\scriptsize},
axis lines = middle,
xmin=-5.5, xmax=5.5, % The range over which the x axis is drawn
ymin=-4.5, ymax=6.0, % The range over which the y axis is drawn
domain=-6:5.5,         % The range over which the function is evaluated
grid=both,
xlabel=$x$, ylabel=$y$
]

\addplot [very thick, blue] {-(0)*x+1} node[above left,font=\small]{$y=1$};
\addplot [very thick, red,domain=6:-3.5] (-2,{x}) node[below,font=\small]{$x=-2$};
\node[dot,label={[font=\small]above right:$0$}] (a) at (0,0){};

\end{axis}
\end{tikzpicture}
\end{document}


• hi, thank you for answering me. I tried to compile the code with your changes but the zero did not move to the desired position. Also, how can I increase the thickness of the cleats and lines and arrows on the Cartesian plane? (I circled them in red). Thank you – ryuk Nov 10 '18 at 21:57