[Tex/LaTex] Inserting graph from a software in Latex

graphs

I made a graph with Desmos.com.

Which I want to insert in my LaTeX code, on the right side of these equations:

\documentclass[12pt,a4paper]{article}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{marginnote}
\begin{document}
\underline {Chandrashekhar EOS (1935)} : \\
\begin{align*}
\overline \rho &= K ~\Big( \sinh ~t ~- ~t\Big)\\
\overline P &= \frac {1}{3} K ~ \Big(\sinh~t -~ 8~ \sinh \frac {1}{2} t  +~ 3t\Big)\\
K &= \frac {1}{4\pi}\\
\end {align*}
\end {document}

How can I label the curve on the graph as P and T and also insert it in my code ?

Best Answer

Sorry this didn't get an answer earlier. But anyway, here is an example using pgfplots and a minipage environments.

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{mathtools}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{marginnote}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\underline {Chandrashekhar EOS (1935)}: 

\noindent\begin{minipage}{0.45\textwidth}
\begin{align*}
\overline \rho &= K \Big( \sinh t - t\Big)\\
\overline P &= \frac {1}{3} K ~ \Big(\sinh t - 8 \sinh \frac {1}{2} t  + 3t\Big)\\
K &= \frac {1}{4\pi}\\
\end {align*}
\end{minipage}\hfill
\begin{tikzpicture}[baseline=(theAxis.west)]
\begin{axis}[
  name=theAxis,
  ymin=-15,ymax=15,
  domain=-8:8,
  samples=50,
  no markers,
  cycle list name=exotic,
  thick,
  width=0.48\textwidth,
  grid, 
  xlabel=$t$,
  ylabel={Something}
%% if you want a legend, uncomment these
%  legend entries={$\overline{\rho}$, $\overline{P}$},
%  legend pos=north west 
]
\addplot {(sinh(x) - x)/(4*pi)} node[left,pos=0.53]{$\overline{\rho}$};
\addplot {(sinh(x) - 8*sinh(x/2) + 3*x)/(3*4*pi)} node[right,pos=0.6]{$\overline{P}$};
\end{axis}
\end{tikzpicture}
\end {document}

If you export the graph from Desmos as e.g. a PNG image, you can do something like this instead, where the image is called graph.png and is in the same folder as the .tex file. The drawback of this method is that the image will likely require scaling, which will also scale the fonts.

\underline {Chandrashekhar EOS (1935)}: 

\noindent\begin{minipage}[b]{0.45\textwidth}
\begin{align*}
\overline \rho &= K \Big( \sinh t - t\Big)\\
\overline P &= \frac {1}{3} K ~ \Big(\sinh t - 8 \sinh \frac {1}{2} t  + 3t\Big)\\
K &= \frac {1}{4\pi}\\
\end {align*}
\end{minipage}\hfill
\includegraphics[width=0.45\textwidth]{graph}
Related Question