Plotting 2D function of two variables

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have:



g(x, y) = x * (y + 3) - 5


I want a 2D plot of the "points" where x and y are 1, 2, 3 .. 10 .
How to do this? I could only find 3d plotting.










share|improve this question







New contributor




Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • I don't understand what you are trying to plot. If x is 1 and y is 1, tehn g[1,1)=-1. What exactly do you want to plot?
    – bill s
    3 hours ago














up vote
1
down vote

favorite












I have:



g(x, y) = x * (y + 3) - 5


I want a 2D plot of the "points" where x and y are 1, 2, 3 .. 10 .
How to do this? I could only find 3d plotting.










share|improve this question







New contributor




Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • I don't understand what you are trying to plot. If x is 1 and y is 1, tehn g[1,1)=-1. What exactly do you want to plot?
    – bill s
    3 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have:



g(x, y) = x * (y + 3) - 5


I want a 2D plot of the "points" where x and y are 1, 2, 3 .. 10 .
How to do this? I could only find 3d plotting.










share|improve this question







New contributor




Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have:



g(x, y) = x * (y + 3) - 5


I want a 2D plot of the "points" where x and y are 1, 2, 3 .. 10 .
How to do this? I could only find 3d plotting.







plotting






share|improve this question







New contributor




Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









Afonso Matos

1084




1084




New contributor




Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Afonso Matos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • I don't understand what you are trying to plot. If x is 1 and y is 1, tehn g[1,1)=-1. What exactly do you want to plot?
    – bill s
    3 hours ago
















  • I don't understand what you are trying to plot. If x is 1 and y is 1, tehn g[1,1)=-1. What exactly do you want to plot?
    – bill s
    3 hours ago















I don't understand what you are trying to plot. If x is 1 and y is 1, tehn g[1,1)=-1. What exactly do you want to plot?
– bill s
3 hours ago




I don't understand what you are trying to plot. If x is 1 and y is 1, tehn g[1,1)=-1. What exactly do you want to plot?
– bill s
3 hours ago










4 Answers
4






active

oldest

votes

















up vote
3
down vote



accepted










g[x_, y_] := x*(y + 3) - 5
MatrixPlot[Array[g, 10, 10], PlotLegends -> Automatic, DataReversed -> True]


enter image description here






share|improve this answer




















  • Beautiful, just as I was searching for. Thank you!
    – Afonso Matos
    2 hours ago

















up vote
1
down vote













A simple 2D plot



g[x_, y_] := x*(y + 3) - 5
tp = Table[
Plot[g[x, y], x, 1, 10, PlotRange -> -5, 120,
PlotLabel -> "y", y, AxesLabel -> "x", "g[x,y]"], y, 1, 10];

gifs = ListAnimate[tp]


enter image description here



Alternatively you could plot g vs y and then vary x.






share|improve this answer



























    up vote
    0
    down vote













    DiscretePlot3D[x (y + 3) - 5, 
    x, 0, 10,
    y, 0, 10]


    enter image description here






    share|improve this answer



























      up vote
      0
      down vote













      g[x_, y_] := x*(y + 3) - 5


      You could use either ContourPlot



      ContourPlot[
      g[x, y], x, 1, 10, y, 1, 10, Contours -> Range[0, 120, 5],
      ContourLabels -> All,
      PlotLegends -> Automatic,
      ColorFunction -> "Rainbow"]


      enter image description here



      or DensityPlot



      DensityPlot[
      g[x, y], x, 1, 10, y, 1, 10,
      PlotLegends -> Automatic,
      ColorFunction -> "Rainbow"]


      enter image description here






      share|improve this answer




















        Your Answer





        StackExchange.ifUsing("editor", function ()
        return StackExchange.using("mathjaxEditing", function ()
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
        );
        );
        , "mathjax-editing");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "387"
        ;
        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',
        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
        );



        );






        Afonso Matos is a new contributor. Be nice, and check out our Code of Conduct.









         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f185481%2fplotting-2d-function-of-two-variables%23new-answer', 'question_page');

        );

        Post as a guest






























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        3
        down vote



        accepted










        g[x_, y_] := x*(y + 3) - 5
        MatrixPlot[Array[g, 10, 10], PlotLegends -> Automatic, DataReversed -> True]


        enter image description here






        share|improve this answer




















        • Beautiful, just as I was searching for. Thank you!
          – Afonso Matos
          2 hours ago














        up vote
        3
        down vote



        accepted










        g[x_, y_] := x*(y + 3) - 5
        MatrixPlot[Array[g, 10, 10], PlotLegends -> Automatic, DataReversed -> True]


        enter image description here






        share|improve this answer




















        • Beautiful, just as I was searching for. Thank you!
          – Afonso Matos
          2 hours ago












        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        g[x_, y_] := x*(y + 3) - 5
        MatrixPlot[Array[g, 10, 10], PlotLegends -> Automatic, DataReversed -> True]


        enter image description here






        share|improve this answer












        g[x_, y_] := x*(y + 3) - 5
        MatrixPlot[Array[g, 10, 10], PlotLegends -> Automatic, DataReversed -> True]


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 3 hours ago









        kglr

        169k8193396




        169k8193396











        • Beautiful, just as I was searching for. Thank you!
          – Afonso Matos
          2 hours ago
















        • Beautiful, just as I was searching for. Thank you!
          – Afonso Matos
          2 hours ago















        Beautiful, just as I was searching for. Thank you!
        – Afonso Matos
        2 hours ago




        Beautiful, just as I was searching for. Thank you!
        – Afonso Matos
        2 hours ago










        up vote
        1
        down vote













        A simple 2D plot



        g[x_, y_] := x*(y + 3) - 5
        tp = Table[
        Plot[g[x, y], x, 1, 10, PlotRange -> -5, 120,
        PlotLabel -> "y", y, AxesLabel -> "x", "g[x,y]"], y, 1, 10];

        gifs = ListAnimate[tp]


        enter image description here



        Alternatively you could plot g vs y and then vary x.






        share|improve this answer
























          up vote
          1
          down vote













          A simple 2D plot



          g[x_, y_] := x*(y + 3) - 5
          tp = Table[
          Plot[g[x, y], x, 1, 10, PlotRange -> -5, 120,
          PlotLabel -> "y", y, AxesLabel -> "x", "g[x,y]"], y, 1, 10];

          gifs = ListAnimate[tp]


          enter image description here



          Alternatively you could plot g vs y and then vary x.






          share|improve this answer






















            up vote
            1
            down vote










            up vote
            1
            down vote









            A simple 2D plot



            g[x_, y_] := x*(y + 3) - 5
            tp = Table[
            Plot[g[x, y], x, 1, 10, PlotRange -> -5, 120,
            PlotLabel -> "y", y, AxesLabel -> "x", "g[x,y]"], y, 1, 10];

            gifs = ListAnimate[tp]


            enter image description here



            Alternatively you could plot g vs y and then vary x.






            share|improve this answer












            A simple 2D plot



            g[x_, y_] := x*(y + 3) - 5
            tp = Table[
            Plot[g[x, y], x, 1, 10, PlotRange -> -5, 120,
            PlotLabel -> "y", y, AxesLabel -> "x", "g[x,y]"], y, 1, 10];

            gifs = ListAnimate[tp]


            enter image description here



            Alternatively you could plot g vs y and then vary x.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 hours ago









            Bill Watts

            2,2081514




            2,2081514




















                up vote
                0
                down vote













                DiscretePlot3D[x (y + 3) - 5, 
                x, 0, 10,
                y, 0, 10]


                enter image description here






                share|improve this answer
























                  up vote
                  0
                  down vote













                  DiscretePlot3D[x (y + 3) - 5, 
                  x, 0, 10,
                  y, 0, 10]


                  enter image description here






                  share|improve this answer






















                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    DiscretePlot3D[x (y + 3) - 5, 
                    x, 0, 10,
                    y, 0, 10]


                    enter image description here






                    share|improve this answer












                    DiscretePlot3D[x (y + 3) - 5, 
                    x, 0, 10,
                    y, 0, 10]


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 3 hours ago









                    David G. Stork

                    22k21747




                    22k21747




















                        up vote
                        0
                        down vote













                        g[x_, y_] := x*(y + 3) - 5


                        You could use either ContourPlot



                        ContourPlot[
                        g[x, y], x, 1, 10, y, 1, 10, Contours -> Range[0, 120, 5],
                        ContourLabels -> All,
                        PlotLegends -> Automatic,
                        ColorFunction -> "Rainbow"]


                        enter image description here



                        or DensityPlot



                        DensityPlot[
                        g[x, y], x, 1, 10, y, 1, 10,
                        PlotLegends -> Automatic,
                        ColorFunction -> "Rainbow"]


                        enter image description here






                        share|improve this answer
























                          up vote
                          0
                          down vote













                          g[x_, y_] := x*(y + 3) - 5


                          You could use either ContourPlot



                          ContourPlot[
                          g[x, y], x, 1, 10, y, 1, 10, Contours -> Range[0, 120, 5],
                          ContourLabels -> All,
                          PlotLegends -> Automatic,
                          ColorFunction -> "Rainbow"]


                          enter image description here



                          or DensityPlot



                          DensityPlot[
                          g[x, y], x, 1, 10, y, 1, 10,
                          PlotLegends -> Automatic,
                          ColorFunction -> "Rainbow"]


                          enter image description here






                          share|improve this answer






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            g[x_, y_] := x*(y + 3) - 5


                            You could use either ContourPlot



                            ContourPlot[
                            g[x, y], x, 1, 10, y, 1, 10, Contours -> Range[0, 120, 5],
                            ContourLabels -> All,
                            PlotLegends -> Automatic,
                            ColorFunction -> "Rainbow"]


                            enter image description here



                            or DensityPlot



                            DensityPlot[
                            g[x, y], x, 1, 10, y, 1, 10,
                            PlotLegends -> Automatic,
                            ColorFunction -> "Rainbow"]


                            enter image description here






                            share|improve this answer












                            g[x_, y_] := x*(y + 3) - 5


                            You could use either ContourPlot



                            ContourPlot[
                            g[x, y], x, 1, 10, y, 1, 10, Contours -> Range[0, 120, 5],
                            ContourLabels -> All,
                            PlotLegends -> Automatic,
                            ColorFunction -> "Rainbow"]


                            enter image description here



                            or DensityPlot



                            DensityPlot[
                            g[x, y], x, 1, 10, y, 1, 10,
                            PlotLegends -> Automatic,
                            ColorFunction -> "Rainbow"]


                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 43 mins ago









                            Bob Hanlon

                            56.7k23591




                            56.7k23591




















                                Afonso Matos is a new contributor. Be nice, and check out our Code of Conduct.









                                 

                                draft saved


                                draft discarded


















                                Afonso Matos is a new contributor. Be nice, and check out our Code of Conduct.












                                Afonso Matos is a new contributor. Be nice, and check out our Code of Conduct.











                                Afonso Matos is a new contributor. Be nice, and check out our Code of Conduct.













                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f185481%2fplotting-2d-function-of-two-variables%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                Comments

                                Popular posts from this blog

                                What does second last employer means? [closed]

                                Installing NextGIS Connect into QGIS 3?

                                One-line joke