banner



How To Draw A Mexican Sombrero

I would like to make a Mexican hat potential (like this one from Wikipedia)

enter image description here

drawing through TikZ, and I am sure the function to use is straightforward, but I have not managed to find the right solution myself... !

I am using this as a starting point, just need the right function...

          \tdplotsetmaincoords{70}{135} \tdplotsetpolarplotrange{90}{180}{0}{360} \begin{tikzpicture}[line join=bevel,tdplot_main_coords, fill opacity=.7] \tdplotsphericalsurfaceplot[parametricfill]{72}{36}% {4}{black}{\tdplottheta}% {\draw[color=black,thick,->] (0,0,0) -- (20,0,0) node[anchor=north east]{$x$};}% {\draw[color=black,thick,->] (0,0,0) -- (0,20,0) node[anchor=north west]{$y$};}% {\draw[color=black,thick,->] (0,0,0) -- (0,0,3) node[anchor=south]{$z$};}% \end{tikzpicture}                  

Any hints will be gratefully appreciated!!


Thanks again!

I now have a little problem getting the axis right. I want them placed in the middle of the plot, but I cannot seem to get the labels correct? Also, I would like to rotate the axis so that the x,y arrows point towards us, and the z up as it is now. Any tips? This is what I have now:

          \pgfplotsset{    standard/.style={     axis x line=middle,     axis y line=middle,     axis z line=middle,     enlarge x limits=0.15,     enlarge y limits=0.15,     enlarge x limits=0.15,     every axis x label/.style={at={(current axis.right of origin)},anchor=north west},     every axis y label/.style={at={(current axis.above origin)},anchor=north east},     every axis z label/.style={at={(current axis.above origin)},anchor=south} } }  \begin{tikzpicture}  \begin{axis}[  standard,         colormap={blackwhite}{gray(0cm)=(1); gray(1cm)=(0)},         samples=30,         domain=0:360,         y domain=0:1.25,         zmin=0,         zmax=2,         xlabel=$\mathcal{RE}\,(\phi)$,         ylabel=$\mathcal{IM}\,(\phi)$,         zlabel=$V$,         yticklabels={,,},         xticklabels={,,},         zticklabels={,,}     ]      \addplot3 [surf, shader=flat, draw=black,  z buffer=sort] ({sin(x)*y}, {cos(x)*y}, {(y^2-1)^2});       %\addplot3 [surf, shader=flat, draw=black, fill=white, z buffer=sort] (x^4-x^2, y^4-y^2, 1);     \end{axis} \end{tikzpicture}                  

It produces the following figure:

enter image description here

But as you see the axis labelling is not optimal, and the axis is rotated the wrong direction..

Thanks so much so far!

How To Draw A Mexican Sombrero

Source: https://tex.stackexchange.com/questions/95247/how-to-draw-a-mexican-hat-potential-using-3dplot

Posted by: ruddmyris1978.blogspot.com

0 Response to "How To Draw A Mexican Sombrero"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel