Graphics, Figures & Tablespgfplots | Proper Decoration Coils

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

pgfplots | Proper Decoration Coils

Post by thinkpadT »

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.

Code: Select all

\documentclass{standalone}
\usepackage[bitstream-charter]{mathdesign} %for a much better readable font
\usepackage{pgfplots}
\usepackage{tikz}
\pgfplotsset{compat=newest}
\usetikzlibrary{positioning} 
\usetikzlibrary{%
  decorations.pathreplacing,%
  decorations.pathmorphing%
}
\begin{document}
  \begin{tikzpicture}
    \begin{axis} [
      xlabel=$\lambda/h$, %$\lambda $ \lbrack $ nm $\rbrack 
      xtick={1,2,...,11},
      ylabel=Efficiency,
      ymax=1,
      ymin=0,
      mark=none,
      legend style={
        legend pos=north east,
        font=\tiny,
        draw=none
      } % place the legend box in the right place  at ={(0.85, 0.65)}
    ]
      \pgfplotstableread{uni-holographic-eff.txt} 
      \teff      %effs=efficiencies
      \addplot [color = blue, mark=none, smooth, very thick] table[y=one] from \teff;
      \addlegendentry{Universal Efficiency Curve of Holographic Grating};
      \draw[decorate,decoration={coil,aspect=0,amplitude=10}] (axis cs:2,0.7) -- (axis cs:3.5,0.7);
    \end{axis}
  \end{tikzpicture}
\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 4930 times
uni-holographic-eff.txt
(5.34 KiB) Downloaded 367 times
Last edited by localghost on Sat Jan 12, 2013 3:47 pm, edited 1 time 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.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

pgfplots | Proper Decoration Coils

Post by localghost »

You could replace the drawn coil by a plot command like this.

Code: Select all

\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
Jamesraw
Posts: 1
Joined: Thu Feb 13, 2020 5:24 pm

pgfplots | Proper Decoration Coils

Post by Jamesraw »

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