2

In this 3d plot of the Mexican hat potential, how can I get the back to extend further upward than the front (as poorly indicated by the blue lines) so as not to obstruct the circle of minima quite so much? enter image description here  

\documentclass[svgnames]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
    
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[
            axis lines=center,
            axis equal,
            domain=0:360,
            y domain=0:1.25,
            y axis line style=stealth-,
            y label style={at={(0.325,0.15)}},
            xmax=1.75,ymax=1.5,zmax=1.5,
            xlabel = $\varphi_1$,
            ylabel=$\varphi_2$,
            zlabel=$U_k(\rho)$,
            ticks=none,
        ]
        
        \addplot3 [surf,shader=flat,draw=black,fill=white,z buffer=sort] ({sin(x)*y}, {cos(x)*y}, {(y^2-1)^2});
        \end{axis}
        \fill[DarkBlue] (3.05,3.4) circle (0.1) coordinate (center);
        \fill[DarkRed] (4.7,2) circle (0.1) coordinate (minimum);
        \draw[LightGray,line width=0.8,shorten <=5,shorten >=5] (center) edge[out=-15,in=150,->] (minimum);
    \end{tikzpicture}
\end{document}

1 Answer 1

3

You can specify the angles from which you see the plot with the view={phi}{theta} option. Moreover, you should define the coordinates of (center) and (minimum) inside the axis environment, and then draw them outside.

\documentclass[svgnames]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}

\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            axis lines=center,
            axis equal,
            domain=0:360,
            y domain=0:1.25,
            y axis line style=stealth-,
            y label style={at={(0.325,0.15)}},
            xmax=1.75,ymax=1.5,zmax=1.5,
            xlabel = $\varphi_1$,
            ylabel=$\varphi_2$,
            zlabel=$U_k(\rho)$,
            ticks=none,
            view={30}{35}
        ]

            \addplot3 [surf,shader=flat,draw=black,fill=white,z buffer=sort] ({sin(x)*y}, {cos(x)*y}, {(y^2-1)^2});
            \coordinate (center) at (axis cs:0,0,1);
            \coordinate (minimum) at (axis cs:{cos(30)},{sin(30)},0);
        \end{axis}
        \fill[DarkBlue] (center) circle (0.1);
        \fill[DarkRed] (minimum) circle (0.1);
        \draw[LightGray,line width=0.8,shorten <=5,shorten >=5] (center) edge[out=-15,in=150,->] (minimum);
    \end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .