Making a contour plot constrained to a circle sector look like a polar plot

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 a contour plot which is a sector of a circle. In the standard form, it is plotted in a framed box (cartesian coordinate). But I want to plot it in a polar coordinate frame. I mean I want to have a grid line in the x-direction and a grid curve for angle part.



Here is my code



ClearAll["Global`*"];
ContourPlot[Cos[x] + Cos[y], x, 0, 4, y, 0, 4, PlotLegends -> Automatic,
RegionFunction -> Function[x, y, 0.01 <= Sqrt[x^2 + y^2] <= 4 && 0. <=ArcTan[x, y] <= [Pi]/3], ImageSize -> Large]


which plots



enter image description here



but I want to have



enter image description here



or



enter image description here



How can I do that?










share|improve this question



























    up vote
    1
    down vote

    favorite












    I have a contour plot which is a sector of a circle. In the standard form, it is plotted in a framed box (cartesian coordinate). But I want to plot it in a polar coordinate frame. I mean I want to have a grid line in the x-direction and a grid curve for angle part.



    Here is my code



    ClearAll["Global`*"];
    ContourPlot[Cos[x] + Cos[y], x, 0, 4, y, 0, 4, PlotLegends -> Automatic,
    RegionFunction -> Function[x, y, 0.01 <= Sqrt[x^2 + y^2] <= 4 && 0. <=ArcTan[x, y] <= [Pi]/3], ImageSize -> Large]


    which plots



    enter image description here



    but I want to have



    enter image description here



    or



    enter image description here



    How can I do that?










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a contour plot which is a sector of a circle. In the standard form, it is plotted in a framed box (cartesian coordinate). But I want to plot it in a polar coordinate frame. I mean I want to have a grid line in the x-direction and a grid curve for angle part.



      Here is my code



      ClearAll["Global`*"];
      ContourPlot[Cos[x] + Cos[y], x, 0, 4, y, 0, 4, PlotLegends -> Automatic,
      RegionFunction -> Function[x, y, 0.01 <= Sqrt[x^2 + y^2] <= 4 && 0. <=ArcTan[x, y] <= [Pi]/3], ImageSize -> Large]


      which plots



      enter image description here



      but I want to have



      enter image description here



      or



      enter image description here



      How can I do that?










      share|improve this question















      I have a contour plot which is a sector of a circle. In the standard form, it is plotted in a framed box (cartesian coordinate). But I want to plot it in a polar coordinate frame. I mean I want to have a grid line in the x-direction and a grid curve for angle part.



      Here is my code



      ClearAll["Global`*"];
      ContourPlot[Cos[x] + Cos[y], x, 0, 4, y, 0, 4, PlotLegends -> Automatic,
      RegionFunction -> Function[x, y, 0.01 <= Sqrt[x^2 + y^2] <= 4 && 0. <=ArcTan[x, y] <= [Pi]/3], ImageSize -> Large]


      which plots



      enter image description here



      but I want to have



      enter image description here



      or



      enter image description here



      How can I do that?







      plotting ticks






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 40 mins ago

























      asked 1 hour ago









      Hadi Sobhani

      1356




      1356




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote













          Ad hoc solution:



          maj, min = π/3 FindDivisions[0, 1, 12, 4];

          ContourPlot[Cos[x] + Cos[y], x, y ∈ Annulus[0, 0, 1/100, 4, 0, π/3],
          AspectRatio -> Automatic, ColorFunction -> "GrayTones",
          Epilog -> Red, Map[Line[Outer[Times, 4 - 1/20, 4,
          AngleVector[#]]] &, min, 2],
          Map[Line[Outer[Times, 4 - 1/10, 4, AngleVector[#]]] &, maj],
          Map[Text[180 # °/π, 4 AngleVector[#], -1.3 AngleVector[#]] &, maj],
          Circle[0, 0, 4, 0, π/3], Frame -> None,
          PlotLegends -> Automatic, PlotRange -> 0, 4, 0, 4, All,
          PlotRangePadding -> Scaled[.05]]


          with circular ticks



          I'll leave generalization and encapsulation into a routine for somebody else to do.






          share|improve this answer




















          • Dear @J. M. is somewhat okay. I have edited my question. It's kind of you if you make the plot similar to what I added recently.
            – Hadi Sobhani
            38 mins ago










          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: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f182529%2fmaking-a-contour-plot-constrained-to-a-circle-sector-look-like-a-polar-plot%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote













          Ad hoc solution:



          maj, min = π/3 FindDivisions[0, 1, 12, 4];

          ContourPlot[Cos[x] + Cos[y], x, y ∈ Annulus[0, 0, 1/100, 4, 0, π/3],
          AspectRatio -> Automatic, ColorFunction -> "GrayTones",
          Epilog -> Red, Map[Line[Outer[Times, 4 - 1/20, 4,
          AngleVector[#]]] &, min, 2],
          Map[Line[Outer[Times, 4 - 1/10, 4, AngleVector[#]]] &, maj],
          Map[Text[180 # °/π, 4 AngleVector[#], -1.3 AngleVector[#]] &, maj],
          Circle[0, 0, 4, 0, π/3], Frame -> None,
          PlotLegends -> Automatic, PlotRange -> 0, 4, 0, 4, All,
          PlotRangePadding -> Scaled[.05]]


          with circular ticks



          I'll leave generalization and encapsulation into a routine for somebody else to do.






          share|improve this answer




















          • Dear @J. M. is somewhat okay. I have edited my question. It's kind of you if you make the plot similar to what I added recently.
            – Hadi Sobhani
            38 mins ago














          up vote
          3
          down vote













          Ad hoc solution:



          maj, min = π/3 FindDivisions[0, 1, 12, 4];

          ContourPlot[Cos[x] + Cos[y], x, y ∈ Annulus[0, 0, 1/100, 4, 0, π/3],
          AspectRatio -> Automatic, ColorFunction -> "GrayTones",
          Epilog -> Red, Map[Line[Outer[Times, 4 - 1/20, 4,
          AngleVector[#]]] &, min, 2],
          Map[Line[Outer[Times, 4 - 1/10, 4, AngleVector[#]]] &, maj],
          Map[Text[180 # °/π, 4 AngleVector[#], -1.3 AngleVector[#]] &, maj],
          Circle[0, 0, 4, 0, π/3], Frame -> None,
          PlotLegends -> Automatic, PlotRange -> 0, 4, 0, 4, All,
          PlotRangePadding -> Scaled[.05]]


          with circular ticks



          I'll leave generalization and encapsulation into a routine for somebody else to do.






          share|improve this answer




















          • Dear @J. M. is somewhat okay. I have edited my question. It's kind of you if you make the plot similar to what I added recently.
            – Hadi Sobhani
            38 mins ago












          up vote
          3
          down vote










          up vote
          3
          down vote









          Ad hoc solution:



          maj, min = π/3 FindDivisions[0, 1, 12, 4];

          ContourPlot[Cos[x] + Cos[y], x, y ∈ Annulus[0, 0, 1/100, 4, 0, π/3],
          AspectRatio -> Automatic, ColorFunction -> "GrayTones",
          Epilog -> Red, Map[Line[Outer[Times, 4 - 1/20, 4,
          AngleVector[#]]] &, min, 2],
          Map[Line[Outer[Times, 4 - 1/10, 4, AngleVector[#]]] &, maj],
          Map[Text[180 # °/π, 4 AngleVector[#], -1.3 AngleVector[#]] &, maj],
          Circle[0, 0, 4, 0, π/3], Frame -> None,
          PlotLegends -> Automatic, PlotRange -> 0, 4, 0, 4, All,
          PlotRangePadding -> Scaled[.05]]


          with circular ticks



          I'll leave generalization and encapsulation into a routine for somebody else to do.






          share|improve this answer












          Ad hoc solution:



          maj, min = π/3 FindDivisions[0, 1, 12, 4];

          ContourPlot[Cos[x] + Cos[y], x, y ∈ Annulus[0, 0, 1/100, 4, 0, π/3],
          AspectRatio -> Automatic, ColorFunction -> "GrayTones",
          Epilog -> Red, Map[Line[Outer[Times, 4 - 1/20, 4,
          AngleVector[#]]] &, min, 2],
          Map[Line[Outer[Times, 4 - 1/10, 4, AngleVector[#]]] &, maj],
          Map[Text[180 # °/π, 4 AngleVector[#], -1.3 AngleVector[#]] &, maj],
          Circle[0, 0, 4, 0, π/3], Frame -> None,
          PlotLegends -> Automatic, PlotRange -> 0, 4, 0, 4, All,
          PlotRangePadding -> Scaled[.05]]


          with circular ticks



          I'll leave generalization and encapsulation into a routine for somebody else to do.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 54 mins ago









          J. M. is somewhat okay.♦

          92.7k10286440




          92.7k10286440











          • Dear @J. M. is somewhat okay. I have edited my question. It's kind of you if you make the plot similar to what I added recently.
            – Hadi Sobhani
            38 mins ago
















          • Dear @J. M. is somewhat okay. I have edited my question. It's kind of you if you make the plot similar to what I added recently.
            – Hadi Sobhani
            38 mins ago















          Dear @J. M. is somewhat okay. I have edited my question. It's kind of you if you make the plot similar to what I added recently.
          – Hadi Sobhani
          38 mins ago




          Dear @J. M. is somewhat okay. I have edited my question. It's kind of you if you make the plot similar to what I added recently.
          – Hadi Sobhani
          38 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182529%2fmaking-a-contour-plot-constrained-to-a-circle-sector-look-like-a-polar-plot%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery