\documentclass[border=1mm]{standalone}

\usepackage{cmap}
\usepackage[cp1250]{inputenc}	
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage{float}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage{upgreek}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepgfplotslibrary{units}
% \makeatletter
%\pgfplotsset{
%  unit code/.code 2 args=
%    \begingroup
%    \protected@edef\x{\endgroup\si{#2}}\x
%} 
%\makeatother

\pgfkeys{%
  /tikz/on layer/.code={
    \pgfonlayer{#1}\begingroup
    \aftergroup\endpgfonlayer
    \aftergroup\endgroup
  }
}

\begin{document}
	\begin{tikzpicture}
		\begin{axis}[
			height=7cm,	width=11cm,	grid=major,
    		x unit=MHz, y unit=db/Hz,
			xlabel={$f$},	ylabel={$\mathit{PSD}$},
			ymin=-160,ymax=-60,
			xmin=200, xmax=1100,
			ytick distance = 20,
			set layers,
			%x tick label style={/pgf/number format/.cd, set thousands separator={}},
			xticklabel shift = 2 pt,
			legend pos=north east,
			%xtick =\empty
		]					
			
			\addplot +[solid,color=blue,mark=none] table [x index={0}, y index={1}, col sep=comma] {PSD_unlocked.csv};
			\addlegendentry{injection pulled};
			\addplot +[solid,color=red,mark=none] table [x index={0}, y index={1}, col sep=comma] {PSD_locked.csv};
			\addlegendentry{injection locked};
		\end{axis}
		
	\end{tikzpicture}
\end{document}