0

About 1/10 of one of my plots gets cut off on both sides, no matter how xmin and xmax are set. How can this be prevented?

\documentclass{standalone}
\usepackage{tikz,pgfplots}

\begin{document}

        \begin{tikzpicture} \pgfplotsset{scale only axis}
        \begin{axis}[ymin=0,xmin=0,xmax=1,
        axis y line*=left,
        width=13cm,height=7cm,tick align=center]
        \addplot[smooth]
        coordinates{
            (0.0001,2)
            (0.999999,2)    
        };  
        \end{axis}

        \begin{axis}[axis y line*=right,
        axis x line=none,width=13cm,height=7cm]

        \addplot[dotted]
        coordinates{
            (0.0001, 1)
            (0.99999,1)};   
        \end{axis}
        \end{tikzpicture}

\end{document}
  • 2
    You have to give, xmin, xmax, ymin and ymax to the second axis environment too. But I am not sure what you really want to do. – koleygr Mar 6 at 16:22
  • 1
    If you replace \pgfplotsset{scale only axis} by \pgfplotsset{scale only axis,xmin=0,xmax=1} then these values will apply to all plots in this tikzpicture. – user121799 Mar 6 at 16:26
  • Both approaches managed to solve my problem. Thanks. – cheesus Mar 7 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.