data_plot


\documentclass[margin=10pt]{standalone}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{filecontents}

\pgfplotsset{compat=newest}
\usepgfplotslibrary{units}

\begin{filecontents*}{"data.csv"}
Distance, Power
0.1,-14
2,-47
4.6, -53
9.2, -64
13.8, -70
18.4, -71
23, -78
23.11,-81
23.46, -83
\end{filecontents*}

\begin{filecontents*}{"theoretical_1.csv"}
Distance, Power
2 ,  -46.06659693356042
4.6 ,  -53.30115365391228
9.2 ,  -59.321753567191905
13.8 ,  -62.84357874830553
18.4 ,  -65.34235348047152
23 ,  -67.28055374063266
23.11 ,  -67.32199592986298
23.46 ,  -67.45255717587101
\end{filecontents*}

\begin{filecontents*}{"theoretical_021.csv"}
Distance, Power
2,-52.844403986221224
4.6,-60.07896070657307
9.2,-66.0995606198527
13.8,-69.62138580096634
18.4,-72.12016053313232
23,-74.05836079329346
23.11,-74.09980298252378
23.46,-74.23036422853181
\end{filecontents*}

\begin{document}
\begin{tikzpicture}[scale=0.9]
  \begin{axis}[
      width=\linewidth, % Scale the plot to \linewidth
      grid=major, 
      grid style={dashed,gray!30},
      tick align=outside,
      tick pos=lower,
      xtick={0,2,...,26},
      xticklabel style={rotate=-30},
      xlabel=Distance, % Set the labels
      ylabel=$P_{RX}$,
      x unit=m,
      y unit= dBm,
      legend style={at={(0.7,0.95)},anchor=north},
      x tick label style={rotate=90,anchor=east}
    ]
    \addplot table[x=Distance, y=Power, col sep=comma] {data.csv}; 
    \addplot table[x=Distance, y=Power, col sep=comma] {theoretical_1.csv}; 
    \addplot table[x=Distance, y=Power, col sep=comma] {theoretical_021.csv};
    \legend{Measured $P_{RX}$, Theoretical $P_{RX}$  ($\eta = 1$), Theoretical $P_{RX}$ ($\eta = 0.21$)}
  \end{axis}
\end{tikzpicture}
\end{document}