0

In the following pgfplots plot, how do I clip the horizontal (x-) axis and the two horizontal grid lines so that the stop on the left a bit to the left of the vertical (y-) axix, say at x = -1.1, and stop on the right a bit to the right of x = 1, say at x = 1.1?

\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}[thick,scale=1.0]
  \begin{axis}[% 
      xmin=-0.01, xmax=1.1, ymin=-1.1, ymax=1.2,
      xtick={1}, ytick={-1,1},
      axis lines=middle, 
      xlabel={$x$}, ylabel={$y$}, axis equal,
      ymajorgrids,
      grid style={line width=0.5pt, draw=gray!70, dashed},
    ]
    \addplot[domain=0.0025:1,samples=5000,smooth,red] {sin(deg(1/x))};
  \end{axis}
\end{tikzpicture}

\end{document}

Topologist's sine curve

4
  • Hm, try to remove option axis equal, and then see, if the result is what you after.
    – Zarko
    Sep 19 at 23:46
  • @Zarko: Aha! Thank. And now I understand a bit more about what the various options do!
    – murray
    Sep 20 at 1:45
  • 4
    I’m voting to close this question because it was solved in the comments 2 days ago
  • I was hoping Zarko would make his comment an answer, so I could accept it.
    – murray
    yesterday

0

Browse other questions tagged or ask your own question.