0

I would like to add zero to the origin of the axes. I tried with clip = false and \node[anchor=east] (zero) at (axis cs:0,0) {0}; but with disastrous results. This is my graph:

\documentclass[tikz]{standalone}
\definecolor{viola}{HTML}{8100FF}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\renewcommand{\dim}[1]{\left[\mathrm{#1}\right]}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
  \begin{axis}[
  legend pos=outer north east,
  legend cell align={left},
  xmax=8,xmin=0,
  ymax=1,ymin=0,
  yticklabels=\empty, xticklabels=\empty,
  width=8cm,
  height=6cm,
  xtick=\empty, ytick={0},
    axis lines=middle,
    x label style={at={(1,0)},right},
    y label style={at={(0,1)},above},
    xlabel={$T$}, ylabel={$\xi$},
    restrict y to domain=-10:1
               ]
        \node[anchor=east] (zero) at (axis cs:0,0) {0};                 
        \addplot [viola,smooth,domain=0:7,samples=1000] 
        {1-( (0*exp(-1/4)) *exp(1/x))};
        \addlegendentry{$r = 0$};
        \addplot [blue, domain=0:7, samples=100,  smooth]
        {1-( (0.2*exp(-1/4)) *exp(1/x))};
        \addplot [green, domain=0:7, samples=100,  smooth] 
        {1-( (0.4*exp(-1/4)) *exp(1/x))};
        \addplot [yellow,smooth,domain=0:7] 
        {1-( (0.6*exp(-1/4)) *exp(1/x))};
        \addplot [orange,smooth,domain=0:7] 
        {1-( (0.8*exp(-1/4)) *exp(1/x))};
        \addplot [red,smooth,domain=0:7] 
        {1-( (1*exp(-1/4)) *exp(1/x))};
        
        \addplot[only marks, mark=*,fill=cyan] coordinates { 
        (0.5377969296,0) 
        (0.8574191432,0)
        (1.3143616208,0)
        (2.1135234692,0)  
        (4,0)   
        };
    \end{axis}
    \draw[-stealth] (6,3) -- ++(0,-2) node[midway,above,anchor=west] {$r$ crescente};
\end{tikzpicture}
\end{figure}
\end{document}

Any ideas?

2

1 Answer 1

0

When using axis lines=middle, PGFPlots will hide the tick labels around origin, to prevent axis lines interfering with them. To disable this feature, you can use hide obscured y ticks=false like this:

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=8,
ymin=0, ymax=1,
xtick=\empty, ytick={0},
axis lines=middle,
hide obscured y ticks=false,
]
\end{axis}
\end{tikzpicture}
\end{document}

Empty graph with a "0" tick

Your Answer

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

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