LaTeX forum ⇒ Graphics, Figures & Tablespgfplots | Proper Decoration Coils

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

pgfplots | Proper Decoration Coils

Postby thinkpadT » Sat Jan 12, 2013 3:41 pm

hi everyone,

for the plotted curve, there is the need of the sinusoidal grating profile on the plot. For this purpose decoration is used. But the result is not satisfactory because i could not manage to get rid of the tail and expand/change the distance between the crests and troughs d.

  1. \documentclass{standalone}
  2. \usepackage[bitstream-charter]{mathdesign} %for a much better readable font
  3. \usepackage{pgfplots}
  4. \usepackage{tikz}
  5. \pgfplotsset{compat=newest}
  6. \usetikzlibrary{positioning}
  7. \usetikzlibrary{%
  8. decorations.pathreplacing,%
  9. decorations.pathmorphing%
  10. }
  11. \begin{document}
  12. \begin{tikzpicture}
  13. \begin{axis} [
  14. xlabel=$\lambda/h$, %$\lambda $ \lbrack $ nm $\rbrack
  15. xtick={1,2,...,11},
  16. ylabel=Efficiency,
  17. ymax=1,
  18. ymin=0,
  19. mark=none,
  20. legend style={
  21. legend pos=north east,
  22. font=\tiny,
  23. draw=none
  24. } % place the legend box in the right place at ={(0.85, 0.65)}
  25. ]
  26. \pgfplotstableread{uni-holographic-eff.txt}
  27. \teff %effs=efficiencies
  28. \addplot [color = blue, mark=none, smooth, very thick] table[y=one] from \teff;
  29. \addlegendentry{Universal Efficiency Curve of Holographic Grating};
  30. \draw[decorate,decoration={coil,aspect=0,amplitude=10}] (axis cs:2,0.7) -- (axis cs:3.5,0.7);
  31. \end{axis}
  32. \end{tikzpicture}
  33. \end{document}

Till now i have only found "hacks" on how to manipulate coils; are there a direct method available too?


Thanks in advance
-Fawad
Attachments
Neu Bitmap.JPG
Neu Bitmap.JPG (5.9 KiB) Viewed 2091 times
uni-holographic-eff.txt
(5.34 KiB) Downloaded 214 times
Last edited by localghost on Sat Jan 12, 2013 3:47 pm, edited 1 time in total.
Reason: Longer passages of source code are tagged as code block, not as in-line code.

Tags:

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sat Jan 12, 2013 4:12 pm

You could replace the drawn coil by a plot command like this.
  1. \addplot[domain=2:3.62,samples=50] {0.05*sin(10*deg(x)-80)+0.7};

The parameters are the result of some fiddling.


Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

Jamesraw
Posts: 1
Joined: Thu Feb 13, 2020 5:24 pm

Postby Jamesraw » Thu Feb 13, 2020 5:29 pm

Wow, you guys are genius! Indeed, the result always depends on good handling.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 6 guests