Size problems when plotting xy/(x^2+2y^2)Omitting a range when plotting with pgfplotsDisplay problems when...

Do "fields" always combine by addition?

What is the difference between "...", '...', $'...', and $"..." quotes?

Is a new boolean field better than null reference when a value can be meaningfully absent?

Am I a Rude Number?

Why are all my replica super soldiers young adults or old teenagers?

Non-Cancer terminal illness that can affect young (age 10-13) girls?

Identify KNO3 and KH2PO4 at home

Square Root Distance from Integers

After checking in online, how do I know whether I need to go show my passport at airport check-in?

Why does photorec keep finding files after I have filled the disk free space as root?

TikZ graph edges not drawn nicely

Boss asked me to sign a resignation paper without a date on it along with my new contract

How does Leonard in "Memento" remember reading and writing?

Limits of a density function

Play Zip, Zap, Zop

Globe trotting Grandpa. Where is he going next?

Potential client has a problematic employee I can't work with

Is there a defined priority for pattern matching?

Why are the books in the Game of Thrones citadel library shelved spine inwards?

Custom color for fence, whisker and outliers in BoxWhiskerChart

Should I reinstall Linux when changing the laptop's CPU?

Hilchos Shabbos English Sefer

Why is Agricola named as such?

Looking for a specific 6502 Assembler



Size problems when plotting xy/(x^2+2y^2)


Omitting a range when plotting with pgfplotsDisplay problems when plotting large datasets (unwanted spikes)Problems plotting histograms as a line graph?How to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Mysterious dash when plotting TikZProblems at Plotting the function in 3d SystemProblems with plotting planar functions with Tikzcreate a standalone legend for a grid of plotsStrange asymmetry when plotting identical exponents?Difficulties (unexplained error message) when plotting contour













7















I would like to plot the funtion xy/(x^2+2y^2) using PGFPlots. Here is what I want:



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}


What I have done



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!!










share|improve this question

















This question has an open bounty worth +50
reputation from manooooh ending in 7 days.


One or more of the answers is exemplary and worthy of an additional bounty.


marmot is one of the best users.












  • 1





    Are you sure you want to plot the function in this way? If you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r 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.

    – marmot
    Feb 24 at 7:02











  • @marmot please see the edit. The function has a "normal" behaviour when changing domain y=-1.2:1 to domain 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?

    – manooooh
    Feb 24 at 7:05








  • 1





    Normally you can set width=15cm or something like this. Of course, with axis equal image, one needs to be a bit careful. What I meant to say is that the function is not well-defined at x=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.

    – marmot
    Feb 24 at 7:11






  • 1





    I need to sleep so I will just post some 1d plot.

    – marmot
    Feb 24 at 7:28






  • 1





    Please do not alter the question that essentially by editing. It is much better to ask a new question.

    – TeXnician
    Feb 24 at 7:45
















7















I would like to plot the funtion xy/(x^2+2y^2) using PGFPlots. Here is what I want:



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}


What I have done



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!!










share|improve this question

















This question has an open bounty worth +50
reputation from manooooh ending in 7 days.


One or more of the answers is exemplary and worthy of an additional bounty.


marmot is one of the best users.












  • 1





    Are you sure you want to plot the function in this way? If you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r 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.

    – marmot
    Feb 24 at 7:02











  • @marmot please see the edit. The function has a "normal" behaviour when changing domain y=-1.2:1 to domain 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?

    – manooooh
    Feb 24 at 7:05








  • 1





    Normally you can set width=15cm or something like this. Of course, with axis equal image, one needs to be a bit careful. What I meant to say is that the function is not well-defined at x=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.

    – marmot
    Feb 24 at 7:11






  • 1





    I need to sleep so I will just post some 1d plot.

    – marmot
    Feb 24 at 7:28






  • 1





    Please do not alter the question that essentially by editing. It is much better to ask a new question.

    – TeXnician
    Feb 24 at 7:45














7












7








7


0






I would like to plot the funtion xy/(x^2+2y^2) using PGFPlots. Here is what I want:



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}


What I have done



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!!










share|improve this question
















I would like to plot the funtion xy/(x^2+2y^2) using PGFPlots. Here is what I want:



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}


What I have done



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!!







tikz-pgf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 24 at 7:57







manooooh

















asked Feb 24 at 6:34









manoooohmanooooh

1,1061516




1,1061516






This question has an open bounty worth +50
reputation from manooooh ending in 7 days.


One or more of the answers is exemplary and worthy of an additional bounty.


marmot is one of the best users.








This question has an open bounty worth +50
reputation from manooooh ending in 7 days.


One or more of the answers is exemplary and worthy of an additional bounty.


marmot is one of the best users.










  • 1





    Are you sure you want to plot the function in this way? If you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r 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.

    – marmot
    Feb 24 at 7:02











  • @marmot please see the edit. The function has a "normal" behaviour when changing domain y=-1.2:1 to domain 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?

    – manooooh
    Feb 24 at 7:05








  • 1





    Normally you can set width=15cm or something like this. Of course, with axis equal image, one needs to be a bit careful. What I meant to say is that the function is not well-defined at x=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.

    – marmot
    Feb 24 at 7:11






  • 1





    I need to sleep so I will just post some 1d plot.

    – marmot
    Feb 24 at 7:28






  • 1





    Please do not alter the question that essentially by editing. It is much better to ask a new question.

    – TeXnician
    Feb 24 at 7:45














  • 1





    Are you sure you want to plot the function in this way? If you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r 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.

    – marmot
    Feb 24 at 7:02











  • @marmot please see the edit. The function has a "normal" behaviour when changing domain y=-1.2:1 to domain 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?

    – manooooh
    Feb 24 at 7:05








  • 1





    Normally you can set width=15cm or something like this. Of course, with axis equal image, one needs to be a bit careful. What I meant to say is that the function is not well-defined at x=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.

    – marmot
    Feb 24 at 7:11






  • 1





    I need to sleep so I will just post some 1d plot.

    – marmot
    Feb 24 at 7:28






  • 1





    Please do not alter the question that essentially by editing. It is much better to ask a new question.

    – TeXnician
    Feb 24 at 7:45








1




1





Are you sure you want to plot the function in this way? If you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r 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.

– marmot
Feb 24 at 7:02





Are you sure you want to plot the function in this way? If you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r 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.

– marmot
Feb 24 at 7:02













@marmot please see the edit. The function has a "normal" behaviour when changing domain y=-1.2:1 to domain 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?

– manooooh
Feb 24 at 7:05







@marmot please see the edit. The function has a "normal" behaviour when changing domain y=-1.2:1 to domain 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?

– manooooh
Feb 24 at 7:05






1




1





Normally you can set width=15cm or something like this. Of course, with axis equal image, one needs to be a bit careful. What I meant to say is that the function is not well-defined at x=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.

– marmot
Feb 24 at 7:11





Normally you can set width=15cm or something like this. Of course, with axis equal image, one needs to be a bit careful. What I meant to say is that the function is not well-defined at x=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.

– marmot
Feb 24 at 7:11




1




1





I need to sleep so I will just post some 1d plot.

– marmot
Feb 24 at 7:28





I need to sleep so I will just post some 1d plot.

– marmot
Feb 24 at 7:28




1




1





Please do not alter the question that essentially by editing. It is much better to ask a new question.

– TeXnician
Feb 24 at 7:45





Please do not alter the question that essentially by editing. It is much better to ask a new question.

– TeXnician
Feb 24 at 7:45










1 Answer
1






active

oldest

votes


















5














Not an answer to the (LaTeX part of the) question. However, if you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r but only on the angle. So away from the origin x=y=0 all the information is already in a one-dimensional plot.



documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
begin{document}
begin{tikzpicture}[declare function={fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
begin{axis}
addplot[domain=0:360,smooth,samples=101] {fan(x)};
end{axis}
end{tikzpicture}
end{document}


enter image description here



And this yields a 3d smooth plot.



documentclass[tikz,border=3.14mm]{standalone}

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{tikzpicture}[declare function={f(x,y)=(x*y)/(x*x+2*y*y);
fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
begin{axis} [width=18cm,
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},
data cs=polar,
]

addplot3[surf,mesh/ordering=y varies,shader=interp,domain=0:360,
domain y=0:1,samples=61, samples y=21,
z buffer=sort] { fan(x)};
addlegendentry{{$f(x,y)$}}
end{axis}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476422%2fsize-problems-when-plotting-xy-x22y2%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    Not an answer to the (LaTeX part of the) question. However, if you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r but only on the angle. So away from the origin x=y=0 all the information is already in a one-dimensional plot.



    documentclass[tikz,border=3.14mm]{standalone}
    usepackage{pgfplots}
    pgfplotsset{compat=1.15}
    begin{document}
    begin{tikzpicture}[declare function={fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
    begin{axis}
    addplot[domain=0:360,smooth,samples=101] {fan(x)};
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here



    And this yields a 3d smooth plot.



    documentclass[tikz,border=3.14mm]{standalone}

    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{tikzpicture}[declare function={f(x,y)=(x*y)/(x*x+2*y*y);
    fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
    begin{axis} [width=18cm,
    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},
    data cs=polar,
    ]

    addplot3[surf,mesh/ordering=y varies,shader=interp,domain=0:360,
    domain y=0:1,samples=61, samples y=21,
    z buffer=sort] { fan(x)};
    addlegendentry{{$f(x,y)$}}
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer






























      5














      Not an answer to the (LaTeX part of the) question. However, if you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r but only on the angle. So away from the origin x=y=0 all the information is already in a one-dimensional plot.



      documentclass[tikz,border=3.14mm]{standalone}
      usepackage{pgfplots}
      pgfplotsset{compat=1.15}
      begin{document}
      begin{tikzpicture}[declare function={fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
      begin{axis}
      addplot[domain=0:360,smooth,samples=101] {fan(x)};
      end{axis}
      end{tikzpicture}
      end{document}


      enter image description here



      And this yields a 3d smooth plot.



      documentclass[tikz,border=3.14mm]{standalone}

      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{tikzpicture}[declare function={f(x,y)=(x*y)/(x*x+2*y*y);
      fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
      begin{axis} [width=18cm,
      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},
      data cs=polar,
      ]

      addplot3[surf,mesh/ordering=y varies,shader=interp,domain=0:360,
      domain y=0:1,samples=61, samples y=21,
      z buffer=sort] { fan(x)};
      addlegendentry{{$f(x,y)$}}
      end{axis}
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer




























        5












        5








        5







        Not an answer to the (LaTeX part of the) question. However, if you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r but only on the angle. So away from the origin x=y=0 all the information is already in a one-dimensional plot.



        documentclass[tikz,border=3.14mm]{standalone}
        usepackage{pgfplots}
        pgfplotsset{compat=1.15}
        begin{document}
        begin{tikzpicture}[declare function={fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
        begin{axis}
        addplot[domain=0:360,smooth,samples=101] {fan(x)};
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here



        And this yields a 3d smooth plot.



        documentclass[tikz,border=3.14mm]{standalone}

        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{tikzpicture}[declare function={f(x,y)=(x*y)/(x*x+2*y*y);
        fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
        begin{axis} [width=18cm,
        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},
        data cs=polar,
        ]

        addplot3[surf,mesh/ordering=y varies,shader=interp,domain=0:360,
        domain y=0:1,samples=61, samples y=21,
        z buffer=sort] { fan(x)};
        addlegendentry{{$f(x,y)$}}
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer















        Not an answer to the (LaTeX part of the) question. However, if you use polar coordinates in the x-y plane, x=r cos(phi) and y=r sin(phi), you see that the function does not depend on r but only on the angle. So away from the origin x=y=0 all the information is already in a one-dimensional plot.



        documentclass[tikz,border=3.14mm]{standalone}
        usepackage{pgfplots}
        pgfplotsset{compat=1.15}
        begin{document}
        begin{tikzpicture}[declare function={fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
        begin{axis}
        addplot[domain=0:360,smooth,samples=101] {fan(x)};
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here



        And this yields a 3d smooth plot.



        documentclass[tikz,border=3.14mm]{standalone}

        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{tikzpicture}[declare function={f(x,y)=(x*y)/(x*x+2*y*y);
        fan(t)=-(sin(2*t)/(-3 + cos(2*t)));}]
        begin{axis} [width=18cm,
        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},
        data cs=polar,
        ]

        addplot3[surf,mesh/ordering=y varies,shader=interp,domain=0:360,
        domain y=0:1,samples=61, samples y=21,
        z buffer=sort] { fan(x)};
        addlegendentry{{$f(x,y)$}}
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 days ago

























        answered Feb 24 at 7:29









        marmotmarmot

        104k4123234




        104k4123234






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476422%2fsize-problems-when-plotting-xy-x22y2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown