Draw a graph in using latex

659 views Asked by At

I used \includegraphics[height=1.91in,width=5in]{L1F2.jpg} to insert in the latex. but I would like to draw similar picture in latex and add my own text on it similar to what included and change the little in the arrows. What is the best way to do so.

enter image description here

1

There are 1 answers

0
gmarmstrong On

You'll want to \usepackage{tikz}. Examples of graphics made with TikZ and PGF can be found at texample.net/tikz.

A quick example:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw[-] (0,0) -- (0,4) node[below left] {$y$}; % Draw the y-axis
    \draw[-] (0,0) -- (4,0) node[below left] {$x$}; % Draw the x-axis
    \foreach \x in {1,2,3} % Iterate through {1,2,3} to assist the next line
        \draw[shift={(\x,0)}] (0,3pt) -- (0,0pt) node[below] {$x_\x$}; % Mark the intervals
    \clip (0,0) rectangle (4,4); % Limit the domain and range of the graph
    \draw (0,0) plot ({\x},{\x^2}); % Draw a function of \x 
\end{tikzpicture}

\end{document}

(I recognize that this is a simple linear regression model, but having just begun college calculus, I don't yet understand how to write this function in gnuplot without knowing the values of $beta_0$ and $beta_1$.)