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 would like to know why the x axis partially disappears, given the following code. Is it a PDF problem? Also, is there any option to connect the midpoints automatically but not in a smooth fashion?

The code is:

\documentclass[landscape]{article}

\usepackage{etex}
\usepackage{pgfplots}
\usepackage{siunitx}
\usepackage{tikz}

\usetikzlibrary{backgrounds,fadings}

\begin{document}

\begin{tikzpicture}%[show background grid]

\tikzstyle{every node}=[font=\scriptsize]

\begin{axis}[/tikz/ybar, 
ybar legend, 
xtick align=outside,
ymin=0,
axis y line*=left,
bar width=1.5cm,
axis x line*=left,
 nodes near coords= {
    \pgfmathfloattofixed{\pgfplotspointmeta} 
    \num[
        scientific-notation = fixed,
        fixed-exponent = 0,
        round-mode = places,
        round-precision = 2,
        exponent-product=\cdot
    ]{\pgfmathresult}},
enlarge x limits=false,
grid=none,   
height=6cm,
title={},
xlabel={Intervalos de Clase},
ylabel=\rotatebox{-90}{$F_{i}$},
symbolic x coords={$<11.5$,$11.5$,$14.5$,$17.5$,$20.5$,$23.5$,$>23.5$},
xtick={$11.5$,$14.5$,$17.5$,$20.5$,$23.5$},
minor x tick num=1, 
width=\textwidth]
\addplot[white,fill=white] coordinates {($<11.5$,0) ($>23.5$,0)};
\addplot[green!80!black,fill=green!40!white] coordinates {($11.5$,0.32)($14.5$,0.56)   ($17.5$,0.64) ($20.5$,0.76) ($23.5$,1.00)};
\addplot[thick,color=blue,line join=round, smooth] coordinates {($11.5$,0.32) ($14.5$,0.56) ($17.5$,0.64) ($20.5$,0.76) ($23.5$,1.00)};
\legend{}
\end{axis}
\end{tikzpicture}           

\begin{tikzpicture}[overlay]
\node[above] (red) at (0.8,2) {\footnotesize\textcolor{magenta}{Ojiva}};
\node (reddot) at (4.1,3.0) {};
\path[->, color=magenta, line width=0.75] (red) edge [out = 50, in = 145] (reddot);
\node[right] (gre) at (11.5,2.75) {\footnotesize\textcolor{cyan}{Histograma}};
\node (gredot) at (10,2.9) {};
\path[->, color=cyan, line width=0.75] (gre) edge [out = 160, in = 45] (gredot);
\end{tikzpicture}

\end{document}
share|improve this question
    
Try remove [white, fill white] from the first addplot –  Holene May 1 '13 at 19:13
    
Welcome to TeX.sx! –  texenthusiast May 1 '13 at 20:43
    
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The StackExchange staff can merge them together for you. –  Werner May 1 '13 at 23:23

1 Answer 1

The axis line is interrupted because you're drawing two bars with zero height on top of it. To fix this, one way is to say axis on top in the axis options. This will also make sure that the green bars aren't drawn on top of the axis.

It looks like you're using those empty bars only to correct the spacing. Instead of doing that, I would recommend using the enlarge x limits key to add extra space on the left and right of the axis.

To draw a plot consisting of straight line segments, use sharp plot:

\documentclass[landscape]{article}

\usepackage{etex}
\usepackage{pgfplots}
\usepackage{siunitx}
\usepackage{tikz}

\usetikzlibrary{backgrounds,fadings}

\begin{document}

\begin{tikzpicture}%[show background grid]

\tikzstyle{every node}=[font=\scriptsize]

\begin{axis}[/tikz/ybar, 
ybar legend, 
xtick align=outside,
ymin=0,
axis y line*=left,
bar width=1.5cm,
axis x line*=left,
 nodes near coords= {
    \pgfmathfloattofixed{\pgfplotspointmeta} 
    \num[
        scientific-notation = fixed,
        fixed-exponent = 0,
        round-mode = places,
        round-precision = 2,
        exponent-product=\cdot
    ]{\pgfmathresult}},
enlarge x limits=false,
grid=none,  
axis on top, 
height=6cm,
title={},
xlabel={Intervalos de Clase},
ylabel=\rotatebox{-90}{$F_{i}$},
symbolic x coords={$<11.5$,$11.5$,$14.5$,$17.5$,$20.5$,$23.5$,$>23.5$},
xtick={$11.5$,$14.5$,$17.5$,$20.5$,$23.5$},
minor x tick num=1, 
width=\textwidth]
\addplot[white,fill=white] coordinates {($<11.5$,0) ($>23.5$,0)};
\addplot[green!80!black,fill=green!40!white] coordinates {($11.5$,0.32)($14.5$,0.56)   ($17.5$,0.64) ($20.5$,0.76) ($23.5$,1.00)};
\addplot[thick,color=blue, sharp plot] coordinates {($11.5$,0.32) ($14.5$,0.56) ($17.5$,0.64) ($20.5$,0.76) ($23.5$,1.00)};
\legend{}
\end{axis}
\end{tikzpicture}           

\begin{tikzpicture}[overlay]
\node[above] (red) at (0.8,2) {\footnotesize\textcolor{magenta}{Ojiva}};
\node (reddot) at (4.1,3.0) {};
\path[->, color=magenta, line width=0.75] (red) edge [out = 50, in = 145] (reddot);
\node[right] (gre) at (11.5,2.75) {\footnotesize\textcolor{cyan}{Histograma}};
\node (gredot) at (10,2.9) {};
\path[->, color=cyan, line width=0.75] (gre) edge [out = 160, in = 45] (gredot);
\end{tikzpicture}

\end{document}
share|improve this answer
    
better answer. I am deleting mine. –  vrleboss May 3 '13 at 11:19

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.