Graphics, Figures & Tablespgfplots | Smooth a Data Plot

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
thinkpadT
Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm

pgfplots | Smooth a Data Plot

Post by thinkpadT »

Hi everyone,

I wanted to smoothen the plotted line for the used data or even use an linear extrapolation with or without Gnuplot, has anyone experience there and point me to a direction or reference. Please find attached the used data file.

Code: Select all

Code, edit and compile here:
\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis} [
grid =major,
% grid style={dashed},
% thick,
xlabel= $\lambda/h$, %$\lambda $ \lbrack $ nm $\rbrack
% xtick = {3,5,...,31},
% xmax=210,
% xmin=20,
ylabel=Diffraction Efficiency, % \lbrack a.u.\rbrack,x
% yticklabels= , %supress the ylabel numbering
ymax=1,
ymin=0,
mark=none,
legend style={
legend pos=north east,
font=\tiny
}
]
\pgfplotstableread{uni-holographic-eff.txt}
\teff % effs=efficiencies
\addplot[color=blue,mark=none,smooth] table[y=one] from \teff;
\addlegendentry{$m = -1$};
\end{axis}
\end{tikzpicture}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Thx in advance.
Attachments
uni-holographic-eff.txt
(5.68 KiB) Downloaded 608 times
Last edited by localghost on Wed Jan 09, 2013 7:06 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

feuersaenger
Posts: 34
Joined: Sun Oct 16, 2011 5:56 pm

pgfplots | Smooth a Data Plot

Post by feuersaenger »

Hi,

a very simple solution could be to reduce the sampling density by means of each nth point=5, for example

Code: Select all

\addplot[color=blue,mark=none,smooth,each nth point=5] table[y=one] from \teff;
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
this avoids the short edges. Perhaps it suffices?

Kind regards

Christian
thinkpadT
Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm

Re: pgfplots | Smooth a Data Plot

Post by thinkpadT »

Hi,

that worked for me. thanks a lot.

-Fawad
esalset
Posts: 1
Joined: Wed Oct 10, 2018 4:29 pm

pgfplots | Smooth a Data Plot

Post by esalset »

I had the same problem and the solution also worked for me. Thanks!
Post Reply