I would like to plot the funtion xy/(x^2+2y^2) using PGFPlots. Here is what I want:
Please consider this MWE:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\pgfplotsset{soldot/.style={color=black,only marks,mark=*}}
\pgfplotsset{holdot/.style={color=red,fill=white,very thick,only marks,mark=*}}
\begin{document}
\begin{center}
\begin{tikzpicture}[declare function={f(\x,\y)=(\x*\y)/(\x*\x+2*\y*\y);}]
\begin{axis} [
axis on top,
axis equal image,
axis lines=center,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zmin=-1,
zmax=1,
ztick={-1,0,0.33,1},
zticklabels={$-1$,$0$,$1/3$,$1$},
ticklabel style={font=\tiny},
legend pos=outer north east,
legend style={cells={align=left}},
legend cell align={left},
view={-135}{25},
]
\addplot3[surf,mesh/ordering=y varies,shader=interp,domain=-1:1,domain y=-1:1,samples=61, samples y=61] {f(x,y)};;
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
The MWE output has an incredible big zoom, so I would like to resize the plot but not using scale
but another commands, like enlarge limits
. However, all the results are in vain; I can not reproduce the visual appearance of what I want.
Thanks!!
x=r cos(\phi)
andy=r sin(\phi)
, you see that the function does not depend onr
but only on the angle. This explains the behavior at 0, where the function is not well-defined. And otherwise the function depends only on one variable, so I am wondering if you would be better off if you plotted a function of one variable only, or at least use a different parametrization.domain y=-1.2:1
todomain y=-1:1
. If you want to use change of variables go ahead :). Do you know how to "enlarge" the axis without rescaling the entire function in order to make it a little more bigger?width=15cm
or something like this. Of course, withaxis equal image,
one needs to be a bit careful. What I meant to say is that the function is not well-defined atx=y=0
and otherwise only a function that depends on one variable, not on two. You see this actually rather well in the upper plot.