Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to plot some vertical lines (to mark control points on my histogram).

Code to draw the line looks like:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}
\addplot+[sharp plot] coordinates {(14.5, 0.0) (14.5, 1000)};
\end{loglogaxis}
\end{tikzpicture}
\end{document}

But result looks like first point was just dropped, because there is no value in logarithmic coordinate to be equal zero. How can I draw line from X axis?

share|improve this question
    
Be more specific. Where do you want to have your first point? If it is at y=0.0, it appears at minus infinity. –  Turion Mar 27 '12 at 12:10
    
I want to draw line from X axis. Like a grid line, but with it's own style and label in legend. –  iNode Mar 27 '12 at 12:21
    
Yes this is a good option in my case. Thank you! –  iNode Mar 27 '12 at 13:26
add comment

2 Answers

up vote 5 down vote accepted

pgfplots comes with a ycomb plot style, which does what you want:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}
\addplot+[ycomb] coordinates {(14.5, 1000)};
\end{loglogaxis}
\end{tikzpicture}
\end{document}
share|improve this answer
add comment

Because you are trying to address an inf value on an axis, as far as I know, pgfplots by default discards that (unbounded coords=discard). The quickest fix is to put some small positive value instead of zero and then manually adjust the y axis limits such that the perturbation stays out of the plot.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[ymin=500]
\addplot+[sharp plot] coordinates {(14.5, 0.1) (14.5, 1000)};
\end{loglogaxis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.