7

How do I smooth this curve? Tried using gnuplot but its not working.

\documentclass[convert={density=400,outext=.png}]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}[scale=1]
\begin{axis}[line width=2,enlargelimits=false,ylabel=Output Power(dBm)
,xlabel=Control       Voltage(V),
label style={font=\bfseries\Large},
legend style={at={( 0.8,0.2)}, anchor=north west, font=\small},
tick label style={font=\bfseries\large},
grid=major]
\addplot+[no markers, raw gnuplot] gnuplot{plot 'VCO_8hp_2.txt' smooth sbezier;};
\addplot+[no markers, raw gnuplot] gnuplot{plot 'VCO_8hp_2.txt' with points;};
\addlegendentry{$P_o$}
\end{axis}
\end{tikzpicture}
\end{document}

I get the error saying 'Sorry the gnuplot result file could not be found.' My data looks like

Control Frequency
0 152.9
0.2 159.3
0.4 165.2
0.6 170.5
0.8 174.8
1 178.2
1.2 180.5
1.4 182
1.6 183
1.8 183.9
2.0 184.5
  • 2
    For data that's as smooth as that, you don't need gnuplot. Just say \addplot [mark=o, smooth] table {VCO_8hp_2.txt}; – Jake Nov 6 '13 at 17:36
  • Tried using table with smooth. For some reason this is the output.link – user29898 Nov 6 '13 at 17:45
13

As Jake said, this should work :

\documentclass[convert={density=400,outext=.png}]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{filecontents}
\begin{filecontents*}{datafile.dat}
0 152.9
0.2 159.3
0.4 165.2
0.6 170.5
0.8 174.8
1 178.2
1.2 180.5
1.4 182
1.6 183
1.8 183.9
2.0 184.5
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[line width=2,enlargelimits=false,ylabel=Output Power(dBm),xlabel=Control Voltage(V),label style={font=\bfseries\Large},legend style={at={( 0.8,0.2)}, anchor=north west, font=\small},tick label style={font=\bfseries\large},grid=major]
      \addplot[smooth,mark=*] table {datafile.dat};
\end{axis}
\end{tikzpicture}
\end{document}

pic

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.