1

I would like to draw the curve shown below including the marked points and the name of the curve.

enter image description here

Using the code

\begin{center}
\begin{tikzpicture}[scale=0.8,domain=-2:20]
\begin{axis}[
height = 11.7cm,
width = 15cm,
  axis lines=middle,
  grid=major,
  xmin=-2,
  xmax=10,
  ymin=-2,
  ymax=20,
   y label style={at={(axis description cs:0.5,-0.05)},anchor=north},
    x label style={at={(axis description cs:-0.05,.5)},rotate=0,anchor=south},
  xlabel=$y$,
  ylabel=$x$,
  xtick={-2,-1,0,...,14},
  ytick={-2,0,...,20},
  tick style={very thick},
  legend style={
  at={(rel axis cs:0,1)},
  anchor=north west,draw=none,inner sep=0pt,fill=gray!10}
]
\addplot[black,thick,samples=1] {0};
\draw[color=red, smooth] plot (\x,\x*\x-8*\x+16) node[above left] {$y =x^2-8x+16$};
\end{axis}
\end{tikzpicture}    
\end{center}

We can create the graph but unable to mark the points. enter image description here

5

This is based on your own answer with some modifications:

  1. Use \addplot instead of the TikZy \draw plot.
  2. Put scale to the options of the axis (since that may be relevant once you start filling some areas).
  3. Added coordinates with labels.

Result:

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shadows.blur}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[fancy label/.style={fill=white,rounded corners=1pt,blur
shadow}]
\begin{axis}[scale=0.8,
height = 11.7cm,
width = 15cm,
  axis lines=middle,
  grid=major,
  xmin=-2,
  xmax=10,
  ymin=-2,
  ymax=20,
   y label style={at={(axis description cs:0.5,-0.05)},anchor=north},
    x label style={at={(axis description cs:-0.05,.5)},rotate=0,anchor=south},
  xlabel=$y$,
  ylabel=$x$,
  xtick={-2,-1,0,...,14},
  ytick={-2,0,...,20},
  tick style={very thick},
  legend style={
  at={(rel axis cs:0,1)},
  anchor=north west,draw=none,inner sep=0pt,fill=gray!10}
]
\addplot[domain=-2:20,red,thick,smooth] {x*x-8*x+16} node[above left] {$y =x^2-8x+16$};
\node[fill,circle,inner sep=1.5pt,label={[fancy label]right:$(0,16)$}] at
(0,16){};
\node[fill,circle,inner sep=1.5pt,label={[fancy label]below left:$(4,0)$}] at
(4,0){};
\end{axis}
\end{tikzpicture}    
\end{document}

enter image description here

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.