LaTeX forum ⇒ Graphics, Figures & Tablespgfplots | Smooth a Data Plot Topic is solved

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

pgfplots | Smooth a Data Plot

Postby thinkpadT » Wed Jan 09, 2013 6:58 pm

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.
  1. \documentclass{standalone}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{pgfplots,pgfplotstable}
  4.  
  5. \pgfplotsset{compat=newest}
  6.  
  7. \begin{document}
  8. \begin{tikzpicture}
  9. \begin{axis} [
  10. grid =major,
  11. % grid style={dashed},
  12. % thick,
  13. xlabel= $\lambda/h$, %$\lambda $ \lbrack $ nm $\rbrack
  14. % xtick = {3,5,...,31},
  15. % xmax=210,
  16. % xmin=20,
  17. ylabel=Diffraction Efficiency, % \lbrack a.u.\rbrack,x
  18. % yticklabels= , %supress the ylabel numbering
  19. ymax=1,
  20. ymin=0,
  21. mark=none,
  22. legend style={
  23. legend pos=north east,
  24. font=\tiny
  25. }
  26. ]
  27. \pgfplotstableread{uni-holographic-eff.txt}
  28. \teff % effs=efficiencies
  29. \addplot[color=blue,mark=none,smooth] table[y=one] from \teff;
  30. \addlegendentry{$m = -1$};
  31. \end{axis}
  32. \end{tikzpicture}
  33. \end{document}

Thx in advance.
Attachments
uni-holographic-eff.txt
(5.68 KiB) Downloaded 135 times
Last edited by localghost on Wed Jan 09, 2013 7:06 pm, edited 2 times in total.
Reason: Longer passages of source code are tagged as code block, not as in-line code.

Tags:

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

Postby feuersaenger » Wed Jan 09, 2013 9:42 pm

Hi,

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

  1. \addplot[color=blue,mark=none,smooth,each nth point=5] table[y=one] from \teff;


this avoids the short edges. Perhaps it suffices?

Kind regards

Christian

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

Postby thinkpadT » Thu Jan 10, 2013 7:44 pm

Hi,

that worked for me. thanks a lot.

-Fawad

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

Postby esalset » Wed Oct 10, 2018 4:30 pm

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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 10 guests