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

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











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 2 days ago









      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
              yesterday










            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 yesterday









                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
                      yesterday














                    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
                      yesterday












                    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 yesterday

























                    answered 2 days ago









                    Okkes Dulgerci

                    3,5481716




                    3,5481716











                    • Nice quality of the figure! Got it~ Thank you!
                      – Robin_Lyn
                      yesterday
















                    • Nice quality of the figure! Got it~ Thank you!
                      – Robin_Lyn
                      yesterday















                    Nice quality of the figure! Got it~ Thank you!
                    – Robin_Lyn
                    yesterday




                    Nice quality of the figure! Got it~ Thank you!
                    – Robin_Lyn
                    yesterday

















                     

                    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

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay