3

I represented the Cartesian plane and a parabola. Why are the A, B, C, D, E points represented outside the Cartesian plane?

thank you all

here is my code:

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


\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=-4.5, xmax=4.5, % The range over which the x axis is drawn
    ymin=-4.5, ymax=4.5, % The range over which the y axis is drawn
    domain=-4:4,         % The range over which the function is evaluated
    grid=both,
    xlabel=$x$, ylabel=$y$    
]



 \addplot [very thick, blue, smooth] {x^2+2*x-3};



\end{axis}


 %%%POINTS
\node [dot,label=below:\Large$A$] (a) at (-3,0) {};
\node [dot,label=left:\Large$B$] (b) at (-2,-3) {};
\node [dot,label=below:\Large$C$] (c) at (-1,-4) {};
\node [dot,label=right:\Large$D$] (d) at (0,-3) {};
\node [dot,label=right:\Large$E$] (d) at (1,0) {};


\end{tikzpicture}



\end{document}
percusse
  • 157,807
ryuk
  • 2,257

1 Answers1

3

The code below superimposes the points on the curve.

EDIT: I added an \addplot call with samples at option See pgfmanual v3.0.1a Section 22.5 p328.

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

\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=-4.5, xmax=4.5, % The range over which the x axis is drawn
ymin=-4.5, ymax=4.5, % The range over which the y axis is drawn
domain=-4:4,         % The range over which the function is evaluated
grid=both,
xlabel=$x$, ylabel=$y$    
]
 %Curve
 \addplot [very thick, blue, smooth] {x^2+2*x-3};

 %Points
 \node [dot,label=below:\Large$A$] (a) at (axis cs:-3,0) {};
 \node [dot,label=left:\Large$B$] (b) at (axis cs:-2,-3) {};
 \node [dot,label=below:\Large$C$] (c) at (axis cs:-1,-4) {};
 \node [dot,label=right:\Large$D$] (d) at (axis cs:0,-3) {};
 \node [dot,label=right:\Large$E$] (d) at (axis cs:1,0) {};

% Other syntax
 \addplot [mark=*,red,draw=none,samples at={-3,-2,-1,0,1}] {x^2+2*x-3};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

BambOo
  • 8,801
  • 2
  • 20
  • 47