0

I am adding a node to a tikzpicture but it is decentering the figure on the slide. How can I fix this? Sorry. I did not find a similar Q&A here or elsewhere.

My example code:

\documentclass[12pt,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{,tikz,pgfplots}
\usetheme{default}
\begin{document}

\begin{frame}

    \begin{figure}
    \centering
        \begin{tikzpicture}
            \begin{axis}[
            xmin=-4,
            xmax=4,
            xlabel={\empty},
            ymin=0,
            ymax=0.5,
            xtick=\empty, 
            ytick=\empty,
            enlargelimits=false, 
            clip=false, 
            height=9cm, 
            width=13cm, 
            hide y axis,
            no markers,
            axis lines*=left,   
            ] 
            \addplot[color=black,domain=-4:4,samples=100] {1/sqrt(2*pi)*exp(-x^2/2)};
            \addplot+[color=black,fill= blue,mark=none,domain=1:2,samples=100,] {1/sqrt(2*pi)*exp(-x^2/2)} \closedcycle;
            \draw [red]  (axis cs:0,0) -- (axis cs:0,0.40);
            \node[below] at (axis cs:2.8, 0.4)  {VERY LONG TEXT HERE MOVES THE IMAGE}; 
            \end{axis}
        \end{tikzpicture}
    \end{figure}
    
\end{frame}

enter image description here

3
0

You can use

\node[draw,text width=3cm, font=\small] at (axis cs:2.8, 0.4)  {VERY LONG TEXT HERE MOVES THE IMAGE};

without the draw, without the rectangle.

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.