LaTeX forum ⇒ Graphics, Figures & TablesAdditional Line at specific Point on Abscissa

Information and discussion about graphics, figures & tables in LaTeX documents.
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Additional Line at specific Point on Abscissa

Postby jhapk » Thu Jan 23, 2014 7:45 am

I am plotting some data on a log-log plot using pgfplots and getting the following figure as output.
initial.png
initial.png (49.78 KiB) Viewed 1823 times

I want to add a line manually at a particular value of the x-axis to have a final output of something like this (made using Gimp).
final.png
final.png (48.43 KiB) Viewed 1823 times

How can I do this using pgfplots? My present code looks something like this.
  1. \documentclass{article}
  2. \usepackage{pgfplots}
  3.  
  4. \begin{document}
  5. \begin{tikzpicture}
  6. \begin{loglogaxis}[
  7. width=10cm,height=7cm,
  8. title={longitudnal averages},
  9. **code**
  10. **code**
  11. ]
  12. \addplot[
  13. color=brown,
  14. thick,
  15. only marks,
  16. mark=*,
  17. table/x = r
  18. ] table [y=u2]{l_statistics.dat};
  19. \addplot[
  20. **code**
  21. **code**
  22. **code**
  23. **code**
  24. **code**
  25. **code**
  26. ]{ncl_statistics.dat};
  27. \end{loglogaxis}
  28. \end{tikzpicture}
  29. \end{document}

Tags:

esdd
Posts: 34
Joined: Sat Jan 25, 2014 9:13 pm
Location: Germany

Postby esdd » Sat Jan 25, 2014 9:50 pm

Here is an example with an additional line at x=400:

  1. \documentclass[margin=5mm]{standalone}
  2. \usepackage{pgfplots}
  3.  
  4. \begin{document}
  5. \begin{tikzpicture}
  6. \begin{loglogaxis}[xlabel=$x$,ylabel=$y$]
  7. % additional line at x=400:
  8. \draw(current axis.south-|{axis cs:400,1})%
  9. --(current axis.north-|{axis cs:400,1})node[right,pos=0.7]{$x=400$};
  10. \addplot expression[domain=1:10000] {x^-2};
  11. \end{loglogaxis}
  12. \end{tikzpicture}
  13. \end{document}


loglogline.png
loglogline.png (24.48 KiB) Viewed 1800 times

Regards
Elke


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests