ContourPlot — How do I color by contour curvature? The Next CEO of Stack OverflowCustom contour labels in ContourPlotListContourPlot is blocking my geometryHow to plot the contour of f[x,y]==0 if always f[x,y]>=0Contour coloring and (List)ContourPlot projectionMore stream lines in a ListStreamPlotContourPlot - unequal contour spacingContourPlot color problems3D Stack of Disks with dedicated height plotsHow to color Contours in ContourPlot with custom ColorFunctionChanging the color of a specific curve in ContourPlot

Workaholic Formal/Informal

Hindi speaking tourist to UK from India

Trouble understanding the speech of overseas colleagues

Is there a front derailer type that can be mounted on a frame without braze on or fitting on the seat tube, or clamping?

How to prepend a string to only the lines of text which are numbers

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

Rotate a column

How do scammers retract money, while you can’t?

What flight has the highest ratio of time difference to flight time?

How do you know when two objects are so called entangled?

Should I tutor a student who I know has cheated on their homework?

How should I support this large drywall patch?

At which OSI layer a user-generated data resides?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

How to draw dotted circle in Inkscape?

Is it professional to write unrelated content in an almost-emtpy email?

Why does the UK parliament need a vote on the political declaration?

Indicator light circuit

Why do remote companies require working in the US?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Why do we use the plural of movies in this phrase "We went to the movies last night."?

What benefits would be gained by using human laborers instead of drones in deep sea mining?

Burial of a convert out of Judaism

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin



ContourPlot — How do I color by contour curvature?



The Next CEO of Stack OverflowCustom contour labels in ContourPlotListContourPlot is blocking my geometryHow to plot the contour of f[x,y]==0 if always f[x,y]>=0Contour coloring and (List)ContourPlot projectionMore stream lines in a ListStreamPlotContourPlot - unequal contour spacingContourPlot color problems3D Stack of Disks with dedicated height plotsHow to color Contours in ContourPlot with custom ColorFunctionChanging the color of a specific curve in ContourPlot










11












$begingroup$


I'm plotting the stream lines of fluid flow past a cylinder, and I would like the colors to increase with contour curvature (i.e. increase as the velocity of the flow increases. Here's a MWE that seems to color it based on the the y-axis value:



ψ[r_, θ_] := U (r - a^2/r) Sin[θ]
r = Sqrt[x^2 + y^2];
θ = ArcSin[y/r];

stream = ContourPlot[
ψ[r, θ] /. U -> 10, a -> 1,
x, -5,5, y, -5, 5,
Contours -> 10 Table[i, i, -10, 10, 0.025]
];

cyl = Graphics[Disk[0, 0, 1]];

Show[stream, cyl]


stream lines around a cylinder










share|improve this question











$endgroup$
















    11












    $begingroup$


    I'm plotting the stream lines of fluid flow past a cylinder, and I would like the colors to increase with contour curvature (i.e. increase as the velocity of the flow increases. Here's a MWE that seems to color it based on the the y-axis value:



    ψ[r_, θ_] := U (r - a^2/r) Sin[θ]
    r = Sqrt[x^2 + y^2];
    θ = ArcSin[y/r];

    stream = ContourPlot[
    ψ[r, θ] /. U -> 10, a -> 1,
    x, -5,5, y, -5, 5,
    Contours -> 10 Table[i, i, -10, 10, 0.025]
    ];

    cyl = Graphics[Disk[0, 0, 1]];

    Show[stream, cyl]


    stream lines around a cylinder










    share|improve this question











    $endgroup$














      11












      11








      11


      2



      $begingroup$


      I'm plotting the stream lines of fluid flow past a cylinder, and I would like the colors to increase with contour curvature (i.e. increase as the velocity of the flow increases. Here's a MWE that seems to color it based on the the y-axis value:



      ψ[r_, θ_] := U (r - a^2/r) Sin[θ]
      r = Sqrt[x^2 + y^2];
      θ = ArcSin[y/r];

      stream = ContourPlot[
      ψ[r, θ] /. U -> 10, a -> 1,
      x, -5,5, y, -5, 5,
      Contours -> 10 Table[i, i, -10, 10, 0.025]
      ];

      cyl = Graphics[Disk[0, 0, 1]];

      Show[stream, cyl]


      stream lines around a cylinder










      share|improve this question











      $endgroup$




      I'm plotting the stream lines of fluid flow past a cylinder, and I would like the colors to increase with contour curvature (i.e. increase as the velocity of the flow increases. Here's a MWE that seems to color it based on the the y-axis value:



      ψ[r_, θ_] := U (r - a^2/r) Sin[θ]
      r = Sqrt[x^2 + y^2];
      θ = ArcSin[y/r];

      stream = ContourPlot[
      ψ[r, θ] /. U -> 10, a -> 1,
      x, -5,5, y, -5, 5,
      Contours -> 10 Table[i, i, -10, 10, 0.025]
      ];

      cyl = Graphics[Disk[0, 0, 1]];

      Show[stream, cyl]


      stream lines around a cylinder







      plotting color






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 20 at 21:11









      m_goldberg

      87.9k872198




      87.9k872198










      asked Mar 20 at 19:05









      dpholmesdpholmes

      350111




      350111




















          1 Answer
          1






          active

          oldest

          votes


















          14












          $begingroup$

          f = ψ[r, θ] /. U -> 10, a -> 1;
          gradf = D[f, x, y, 1];
          Hessf = D[f, x, y, 2];
          normal = gradf[[1]]/Sqrt[gradf[[1]].gradf[[1]]] // Simplify;
          secondfundamentalform = -PseudoInverse[gradf].Hessf // ComplexExpand // Simplify;
          tangent = RotationMatrix[Pi/2].normal;
          curvaturevector = (secondfundamentalform.tangent).tangent // Simplify;
          signedcurvature = curvaturevector.normal // Simplify;

          stream = ContourPlot[
          ψ[r, θ] /. U -> 10, a -> 1, x, -5, 5, y, -5, 5,
          Contours -> 10 Table[i, i, -10, 10, 0.2],
          ContourShading -> None
          ];
          curvatureplot = DensityPlot[signedcurvature, x, -5, 5, y, -5, 5,
          ColorFunction -> "RedGreenSplit",
          ClippingStyle -> Automatic,
          PlotPoints -> 100,
          PlotRange -> -1, 1
          ];
          Show[
          curvatureplot,
          stream,
          cyl
          ]


          enter image description here






          share|improve this answer











          $endgroup$













            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',
            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%2fmathematica.stackexchange.com%2fquestions%2f193665%2fcontourplot-how-do-i-color-by-contour-curvature%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









            14












            $begingroup$

            f = ψ[r, θ] /. U -> 10, a -> 1;
            gradf = D[f, x, y, 1];
            Hessf = D[f, x, y, 2];
            normal = gradf[[1]]/Sqrt[gradf[[1]].gradf[[1]]] // Simplify;
            secondfundamentalform = -PseudoInverse[gradf].Hessf // ComplexExpand // Simplify;
            tangent = RotationMatrix[Pi/2].normal;
            curvaturevector = (secondfundamentalform.tangent).tangent // Simplify;
            signedcurvature = curvaturevector.normal // Simplify;

            stream = ContourPlot[
            ψ[r, θ] /. U -> 10, a -> 1, x, -5, 5, y, -5, 5,
            Contours -> 10 Table[i, i, -10, 10, 0.2],
            ContourShading -> None
            ];
            curvatureplot = DensityPlot[signedcurvature, x, -5, 5, y, -5, 5,
            ColorFunction -> "RedGreenSplit",
            ClippingStyle -> Automatic,
            PlotPoints -> 100,
            PlotRange -> -1, 1
            ];
            Show[
            curvatureplot,
            stream,
            cyl
            ]


            enter image description here






            share|improve this answer











            $endgroup$

















              14












              $begingroup$

              f = ψ[r, θ] /. U -> 10, a -> 1;
              gradf = D[f, x, y, 1];
              Hessf = D[f, x, y, 2];
              normal = gradf[[1]]/Sqrt[gradf[[1]].gradf[[1]]] // Simplify;
              secondfundamentalform = -PseudoInverse[gradf].Hessf // ComplexExpand // Simplify;
              tangent = RotationMatrix[Pi/2].normal;
              curvaturevector = (secondfundamentalform.tangent).tangent // Simplify;
              signedcurvature = curvaturevector.normal // Simplify;

              stream = ContourPlot[
              ψ[r, θ] /. U -> 10, a -> 1, x, -5, 5, y, -5, 5,
              Contours -> 10 Table[i, i, -10, 10, 0.2],
              ContourShading -> None
              ];
              curvatureplot = DensityPlot[signedcurvature, x, -5, 5, y, -5, 5,
              ColorFunction -> "RedGreenSplit",
              ClippingStyle -> Automatic,
              PlotPoints -> 100,
              PlotRange -> -1, 1
              ];
              Show[
              curvatureplot,
              stream,
              cyl
              ]


              enter image description here






              share|improve this answer











              $endgroup$















                14












                14








                14





                $begingroup$

                f = ψ[r, θ] /. U -> 10, a -> 1;
                gradf = D[f, x, y, 1];
                Hessf = D[f, x, y, 2];
                normal = gradf[[1]]/Sqrt[gradf[[1]].gradf[[1]]] // Simplify;
                secondfundamentalform = -PseudoInverse[gradf].Hessf // ComplexExpand // Simplify;
                tangent = RotationMatrix[Pi/2].normal;
                curvaturevector = (secondfundamentalform.tangent).tangent // Simplify;
                signedcurvature = curvaturevector.normal // Simplify;

                stream = ContourPlot[
                ψ[r, θ] /. U -> 10, a -> 1, x, -5, 5, y, -5, 5,
                Contours -> 10 Table[i, i, -10, 10, 0.2],
                ContourShading -> None
                ];
                curvatureplot = DensityPlot[signedcurvature, x, -5, 5, y, -5, 5,
                ColorFunction -> "RedGreenSplit",
                ClippingStyle -> Automatic,
                PlotPoints -> 100,
                PlotRange -> -1, 1
                ];
                Show[
                curvatureplot,
                stream,
                cyl
                ]


                enter image description here






                share|improve this answer











                $endgroup$



                f = ψ[r, θ] /. U -> 10, a -> 1;
                gradf = D[f, x, y, 1];
                Hessf = D[f, x, y, 2];
                normal = gradf[[1]]/Sqrt[gradf[[1]].gradf[[1]]] // Simplify;
                secondfundamentalform = -PseudoInverse[gradf].Hessf // ComplexExpand // Simplify;
                tangent = RotationMatrix[Pi/2].normal;
                curvaturevector = (secondfundamentalform.tangent).tangent // Simplify;
                signedcurvature = curvaturevector.normal // Simplify;

                stream = ContourPlot[
                ψ[r, θ] /. U -> 10, a -> 1, x, -5, 5, y, -5, 5,
                Contours -> 10 Table[i, i, -10, 10, 0.2],
                ContourShading -> None
                ];
                curvatureplot = DensityPlot[signedcurvature, x, -5, 5, y, -5, 5,
                ColorFunction -> "RedGreenSplit",
                ClippingStyle -> Automatic,
                PlotPoints -> 100,
                PlotRange -> -1, 1
                ];
                Show[
                curvatureplot,
                stream,
                cyl
                ]


                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 21 at 8:40

























                answered Mar 20 at 19:28









                Henrik SchumacherHenrik Schumacher

                58.4k581161




                58.4k581161



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Mathematica 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.

                    Use MathJax to format equations. MathJax reference.


                    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%2fmathematica.stackexchange.com%2fquestions%2f193665%2fcontourplot-how-do-i-color-by-contour-curvature%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

                    Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum

                    He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

                    Bunad