How to exclude a circle from a rectangle when drawing a contour figure?











up vote
3
down vote

favorite












I need to draw a contour figure defined by coordinate x and y. The domain is a rectangle (-100<=x<=100,-100<=y<=100) excluding a circle (center at the origin, and radius of 5). The object function is 'z=x+y'.



What confuses me is how to exclude the circle from the rectangle. How can I draw such a contour figure?










share|improve this question


























    up vote
    3
    down vote

    favorite












    I need to draw a contour figure defined by coordinate x and y. The domain is a rectangle (-100<=x<=100,-100<=y<=100) excluding a circle (center at the origin, and radius of 5). The object function is 'z=x+y'.



    What confuses me is how to exclude the circle from the rectangle. How can I draw such a contour figure?










    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I need to draw a contour figure defined by coordinate x and y. The domain is a rectangle (-100<=x<=100,-100<=y<=100) excluding a circle (center at the origin, and radius of 5). The object function is 'z=x+y'.



      What confuses me is how to exclude the circle from the rectangle. How can I draw such a contour figure?










      share|improve this question













      I need to draw a contour figure defined by coordinate x and y. The domain is a rectangle (-100<=x<=100,-100<=y<=100) excluding a circle (center at the origin, and radius of 5). The object function is 'z=x+y'.



      What confuses me is how to exclude the circle from the rectangle. How can I draw such a contour figure?







      plotting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 at 3:26









      Robin_Lyn

      836




      836






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          You can also use ConditionalExpression as the first argument of ContourPlot:



          ContourPlot[ConditionalExpression[x + y, x^2 + y^2 >= 5^2],
          {x, -100, 100}, {y, -100, 100}, PlotLegends -> Automatic]


          enter image description here






          share|improve this answer




























            up vote
            6
            down vote













            How about this?



            ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
            RegionFunction -> Function[{x, y, z}, x^2 + y^2 >= 5^2],
            PlotPoints -> 100, PerformanceGoal -> "Quality",
            PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"]


            enter image description here



            If the smoothness of disk bothers you (it bothers me), you can cheat it like so:



            Show[ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
            PlotPoints -> 100, PerformanceGoal -> "Quality",
            PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"],
            Graphics[{White, Disk[{0, 0}, 5]}]]


            enter image description here






            share|improve this answer























            • Nice quality of the figure! Got it~ Thank you!
              – Robin_Lyn
              Nov 15 at 6:07











            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
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186014%2fhow-to-exclude-a-circle-from-a-rectangle-when-drawing-a-contour-figure%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            You can also use ConditionalExpression as the first argument of ContourPlot:



            ContourPlot[ConditionalExpression[x + y, x^2 + y^2 >= 5^2],
            {x, -100, 100}, {y, -100, 100}, PlotLegends -> Automatic]


            enter image description here






            share|improve this answer

























              up vote
              2
              down vote



              accepted










              You can also use ConditionalExpression as the first argument of ContourPlot:



              ContourPlot[ConditionalExpression[x + y, x^2 + y^2 >= 5^2],
              {x, -100, 100}, {y, -100, 100}, PlotLegends -> Automatic]


              enter image description here






              share|improve this answer























                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                You can also use ConditionalExpression as the first argument of ContourPlot:



                ContourPlot[ConditionalExpression[x + y, x^2 + y^2 >= 5^2],
                {x, -100, 100}, {y, -100, 100}, PlotLegends -> Automatic]


                enter image description here






                share|improve this answer












                You can also use ConditionalExpression as the first argument of ContourPlot:



                ContourPlot[ConditionalExpression[x + y, x^2 + y^2 >= 5^2],
                {x, -100, 100}, {y, -100, 100}, PlotLegends -> Automatic]


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 15 at 5:20









                kglr

                171k8194399




                171k8194399






















                    up vote
                    6
                    down vote













                    How about this?



                    ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    RegionFunction -> Function[{x, y, z}, x^2 + y^2 >= 5^2],
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"]


                    enter image description here



                    If the smoothness of disk bothers you (it bothers me), you can cheat it like so:



                    Show[ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"],
                    Graphics[{White, Disk[{0, 0}, 5]}]]


                    enter image description here






                    share|improve this answer























                    • Nice quality of the figure! Got it~ Thank you!
                      – Robin_Lyn
                      Nov 15 at 6:07















                    up vote
                    6
                    down vote













                    How about this?



                    ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    RegionFunction -> Function[{x, y, z}, x^2 + y^2 >= 5^2],
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"]


                    enter image description here



                    If the smoothness of disk bothers you (it bothers me), you can cheat it like so:



                    Show[ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"],
                    Graphics[{White, Disk[{0, 0}, 5]}]]


                    enter image description here






                    share|improve this answer























                    • Nice quality of the figure! Got it~ Thank you!
                      – Robin_Lyn
                      Nov 15 at 6:07













                    up vote
                    6
                    down vote










                    up vote
                    6
                    down vote









                    How about this?



                    ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    RegionFunction -> Function[{x, y, z}, x^2 + y^2 >= 5^2],
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"]


                    enter image description here



                    If the smoothness of disk bothers you (it bothers me), you can cheat it like so:



                    Show[ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"],
                    Graphics[{White, Disk[{0, 0}, 5]}]]


                    enter image description here






                    share|improve this answer














                    How about this?



                    ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    RegionFunction -> Function[{x, y, z}, x^2 + y^2 >= 5^2],
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"]


                    enter image description here



                    If the smoothness of disk bothers you (it bothers me), you can cheat it like so:



                    Show[ContourPlot[x + y, {x, -100, 100}, {y, -100, 100}, 
                    PlotPoints -> 100, PerformanceGoal -> "Quality",
                    PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"],
                    Graphics[{White, Disk[{0, 0}, 5]}]]


                    enter image description here







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 15 at 16:12

























                    answered Nov 15 at 3:41









                    Okkes Dulgerci

                    3,5781716




                    3,5781716












                    • Nice quality of the figure! Got it~ Thank you!
                      – Robin_Lyn
                      Nov 15 at 6:07


















                    • Nice quality of the figure! Got it~ Thank you!
                      – Robin_Lyn
                      Nov 15 at 6:07
















                    Nice quality of the figure! Got it~ Thank you!
                    – Robin_Lyn
                    Nov 15 at 6:07




                    Nice quality of the figure! Got it~ Thank you!
                    – Robin_Lyn
                    Nov 15 at 6:07


















                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186014%2fhow-to-exclude-a-circle-from-a-rectangle-when-drawing-a-contour-figure%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







                    Popular posts from this blog

                    Список кардиналов, возведённых папой римским Каликстом III

                    Deduzione

                    Mysql.sock missing - “Can't connect to local MySQL server through socket”