can't blend gradient colors with a stream












5












$begingroup$


The following function generates a plot of the 3d function indicated in the example.



Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
PlotStyle -> {Texture[
StreamPlot[
Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
StreamStyle -> Black]]}]


However, when I choose a different ColorFunction parameter the texture (that only consists of arrows) disappears. Any idea how to correct this? I tried to make the background transparent, combine two 3D plots etc without success. Also, I have no idea why this is happening.



Here is the 3D plot without the gradient field.



Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
PlotStyle -> {Texture[
StreamPlot[
Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
StreamStyle -> Black]]}, ColorFunction -> "Rainbow"]









share|improve this question











$endgroup$

















    5












    $begingroup$


    The following function generates a plot of the 3d function indicated in the example.



    Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
    Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
    PlotStyle -> {Texture[
    StreamPlot[
    Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
    3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
    StreamStyle -> Black]]}]


    However, when I choose a different ColorFunction parameter the texture (that only consists of arrows) disappears. Any idea how to correct this? I tried to make the background transparent, combine two 3D plots etc without success. Also, I have no idea why this is happening.



    Here is the 3D plot without the gradient field.



    Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
    Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
    PlotStyle -> {Texture[
    StreamPlot[
    Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
    3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
    StreamStyle -> Black]]}, ColorFunction -> "Rainbow"]









    share|improve this question











    $endgroup$















      5












      5








      5





      $begingroup$


      The following function generates a plot of the 3d function indicated in the example.



      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
      PlotStyle -> {Texture[
      StreamPlot[
      Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
      3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
      StreamStyle -> Black]]}]


      However, when I choose a different ColorFunction parameter the texture (that only consists of arrows) disappears. Any idea how to correct this? I tried to make the background transparent, combine two 3D plots etc without success. Also, I have no idea why this is happening.



      Here is the 3D plot without the gradient field.



      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
      PlotStyle -> {Texture[
      StreamPlot[
      Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
      3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
      StreamStyle -> Black]]}, ColorFunction -> "Rainbow"]









      share|improve this question











      $endgroup$




      The following function generates a plot of the 3d function indicated in the example.



      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
      PlotStyle -> {Texture[
      StreamPlot[
      Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
      3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
      StreamStyle -> Black]]}]


      However, when I choose a different ColorFunction parameter the texture (that only consists of arrows) disappears. Any idea how to correct this? I tried to make the background transparent, combine two 3D plots etc without success. Also, I have no idea why this is happening.



      Here is the 3D plot without the gradient field.



      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
      PlotStyle -> {Texture[
      StreamPlot[
      Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3,
      3}, {y, -3, 3}, Frame -> None, ImageSize -> Large,
      StreamStyle -> Black]]}, ColorFunction -> "Rainbow"]






      plotting style textures






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 14 at 19:58









      Mr.Wizard

      231k294751042




      231k294751042










      asked Jan 14 at 19:54









      user17164user17164

      1262




      1262






















          3 Answers
          3






          active

          oldest

          votes


















          9












          $begingroup$

          The color is not quite right but the idea seems to work. Edit: much closer now.



          dp = DensityPlot[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
          ColorFunction -> "Rainbow", PlotPoints -> 100];

          sp = StreamPlot[
          Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3, 3}, {y, -3, 3},
          Frame -> None, ImageSize -> Large, StreamStyle -> Black];

          tex = Show[dp, sp, Frame -> None, PlotRangePadding -> 0, ImageSize -> 500];

          Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, Mesh -> None,
          ImageSize -> Large, PlotPoints -> 35
          , PlotStyle -> {Texture[Lighter[tex, 0.15]]}
          , Lighting -> "Neutral"
          ]


          enter image description here






          share|improve this answer











          $endgroup$





















            8












            $begingroup$

            You can use StreamDensityPlot (which accepts the ColorFunction option) to produce the texture:



            sdp = StreamDensityPlot[Evaluate[{-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}], 
            (x^2 + y^2) Exp[1 - x^2 - y^2]}], {x, -3, 3}, {y, -3, 3},
            StreamStyle -> Black,
            ColorFunction -> "Rainbow",
            ColorFunctionScaling -> False, Frame -> False, Axes -> False,
            PlotRangePadding -> None];
            Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3},
            Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
            PlotStyle -> Texture[Lighter@sdp], Lighting -> "Neutral"]


            enter image description here






            share|improve this answer











            $endgroup$













            • $begingroup$
              Slightly shorter: sdp = StreamDensityPlot[ Evaluate[{-D[#, {{x, y}}], #} &[(x^2 + y^2) Exp[ 1 - x^2 - y^2]]], {x, -3, 3}, {y, -3, 3}, StreamStyle -> Black, ColorFunction -> "Rainbow", Frame -> False, Axes -> False, PlotRangePadding -> None];
              $endgroup$
              – Michael E2
              Jan 14 at 21:55










            • $begingroup$
              @MichaelE2, I tried that version; but the colors do not match the colors in Plot3D.
              $endgroup$
              – kglr
              Jan 14 at 23:01










            • $begingroup$
              Odd, they match your code above, for me. I switched between the two images and saw no (perceptible) difference.
              $endgroup$
              – Michael E2
              Jan 14 at 23:02












            • $begingroup$
              @MichaelE2, maybe version/os difference (i am using v 11.3 windows 10/64bit).
              $endgroup$
              – kglr
              Jan 14 at 23:04










            • $begingroup$
              @MichaelE2, ColorFunction -> "Rainbow" does work if the first argument of StreamDensityPlot has the form ${{v_x, v_y}, s }$.
              $endgroup$
              – kglr
              Jan 15 at 1:39



















            2












            $begingroup$

            PlotStyle -> Texture[...] relies on VertexTextureCoordinates to map the texture to polygon vertices.



            ColorFunction -> colorfunction relies on VertexColors to associate colors with the polygon vertices.



            Only one of them actually gets to style the polygon. In my case, it seems to be the texture:



            Graphics3D[{Texture[RandomImage[1, 100]], 
            Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}},
            VertexColors -> {Red, Green, Blue},
            VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}}]},
            Lighting -> "Neutral", BoxRatios -> {1, 1, 1}]


            enter image description here



            It sounds like the color function is winning in your case. It wouldn't surprise me if that was dependent on things like OS, software version, phase of the moon, etc...






            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%2f189485%2fcant-blend-gradient-colors-with-a-stream%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              9












              $begingroup$

              The color is not quite right but the idea seems to work. Edit: much closer now.



              dp = DensityPlot[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
              ColorFunction -> "Rainbow", PlotPoints -> 100];

              sp = StreamPlot[
              Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3, 3}, {y, -3, 3},
              Frame -> None, ImageSize -> Large, StreamStyle -> Black];

              tex = Show[dp, sp, Frame -> None, PlotRangePadding -> 0, ImageSize -> 500];

              Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, Mesh -> None,
              ImageSize -> Large, PlotPoints -> 35
              , PlotStyle -> {Texture[Lighter[tex, 0.15]]}
              , Lighting -> "Neutral"
              ]


              enter image description here






              share|improve this answer











              $endgroup$


















                9












                $begingroup$

                The color is not quite right but the idea seems to work. Edit: much closer now.



                dp = DensityPlot[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
                ColorFunction -> "Rainbow", PlotPoints -> 100];

                sp = StreamPlot[
                Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3, 3}, {y, -3, 3},
                Frame -> None, ImageSize -> Large, StreamStyle -> Black];

                tex = Show[dp, sp, Frame -> None, PlotRangePadding -> 0, ImageSize -> 500];

                Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, Mesh -> None,
                ImageSize -> Large, PlotPoints -> 35
                , PlotStyle -> {Texture[Lighter[tex, 0.15]]}
                , Lighting -> "Neutral"
                ]


                enter image description here






                share|improve this answer











                $endgroup$
















                  9












                  9








                  9





                  $begingroup$

                  The color is not quite right but the idea seems to work. Edit: much closer now.



                  dp = DensityPlot[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
                  ColorFunction -> "Rainbow", PlotPoints -> 100];

                  sp = StreamPlot[
                  Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3, 3}, {y, -3, 3},
                  Frame -> None, ImageSize -> Large, StreamStyle -> Black];

                  tex = Show[dp, sp, Frame -> None, PlotRangePadding -> 0, ImageSize -> 500];

                  Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, Mesh -> None,
                  ImageSize -> Large, PlotPoints -> 35
                  , PlotStyle -> {Texture[Lighter[tex, 0.15]]}
                  , Lighting -> "Neutral"
                  ]


                  enter image description here






                  share|improve this answer











                  $endgroup$



                  The color is not quite right but the idea seems to work. Edit: much closer now.



                  dp = DensityPlot[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, 
                  ColorFunction -> "Rainbow", PlotPoints -> 100];

                  sp = StreamPlot[
                  Evaluate[-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}]], {x, -3, 3}, {y, -3, 3},
                  Frame -> None, ImageSize -> Large, StreamStyle -> Black];

                  tex = Show[dp, sp, Frame -> None, PlotRangePadding -> 0, ImageSize -> 500];

                  Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3}, Mesh -> None,
                  ImageSize -> Large, PlotPoints -> 35
                  , PlotStyle -> {Texture[Lighter[tex, 0.15]]}
                  , Lighting -> "Neutral"
                  ]


                  enter image description here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 14 at 20:25

























                  answered Jan 14 at 20:12









                  Mr.WizardMr.Wizard

                  231k294751042




                  231k294751042























                      8












                      $begingroup$

                      You can use StreamDensityPlot (which accepts the ColorFunction option) to produce the texture:



                      sdp = StreamDensityPlot[Evaluate[{-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}], 
                      (x^2 + y^2) Exp[1 - x^2 - y^2]}], {x, -3, 3}, {y, -3, 3},
                      StreamStyle -> Black,
                      ColorFunction -> "Rainbow",
                      ColorFunctionScaling -> False, Frame -> False, Axes -> False,
                      PlotRangePadding -> None];
                      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3},
                      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
                      PlotStyle -> Texture[Lighter@sdp], Lighting -> "Neutral"]


                      enter image description here






                      share|improve this answer











                      $endgroup$













                      • $begingroup$
                        Slightly shorter: sdp = StreamDensityPlot[ Evaluate[{-D[#, {{x, y}}], #} &[(x^2 + y^2) Exp[ 1 - x^2 - y^2]]], {x, -3, 3}, {y, -3, 3}, StreamStyle -> Black, ColorFunction -> "Rainbow", Frame -> False, Axes -> False, PlotRangePadding -> None];
                        $endgroup$
                        – Michael E2
                        Jan 14 at 21:55










                      • $begingroup$
                        @MichaelE2, I tried that version; but the colors do not match the colors in Plot3D.
                        $endgroup$
                        – kglr
                        Jan 14 at 23:01










                      • $begingroup$
                        Odd, they match your code above, for me. I switched between the two images and saw no (perceptible) difference.
                        $endgroup$
                        – Michael E2
                        Jan 14 at 23:02












                      • $begingroup$
                        @MichaelE2, maybe version/os difference (i am using v 11.3 windows 10/64bit).
                        $endgroup$
                        – kglr
                        Jan 14 at 23:04










                      • $begingroup$
                        @MichaelE2, ColorFunction -> "Rainbow" does work if the first argument of StreamDensityPlot has the form ${{v_x, v_y}, s }$.
                        $endgroup$
                        – kglr
                        Jan 15 at 1:39
















                      8












                      $begingroup$

                      You can use StreamDensityPlot (which accepts the ColorFunction option) to produce the texture:



                      sdp = StreamDensityPlot[Evaluate[{-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}], 
                      (x^2 + y^2) Exp[1 - x^2 - y^2]}], {x, -3, 3}, {y, -3, 3},
                      StreamStyle -> Black,
                      ColorFunction -> "Rainbow",
                      ColorFunctionScaling -> False, Frame -> False, Axes -> False,
                      PlotRangePadding -> None];
                      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3},
                      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
                      PlotStyle -> Texture[Lighter@sdp], Lighting -> "Neutral"]


                      enter image description here






                      share|improve this answer











                      $endgroup$













                      • $begingroup$
                        Slightly shorter: sdp = StreamDensityPlot[ Evaluate[{-D[#, {{x, y}}], #} &[(x^2 + y^2) Exp[ 1 - x^2 - y^2]]], {x, -3, 3}, {y, -3, 3}, StreamStyle -> Black, ColorFunction -> "Rainbow", Frame -> False, Axes -> False, PlotRangePadding -> None];
                        $endgroup$
                        – Michael E2
                        Jan 14 at 21:55










                      • $begingroup$
                        @MichaelE2, I tried that version; but the colors do not match the colors in Plot3D.
                        $endgroup$
                        – kglr
                        Jan 14 at 23:01










                      • $begingroup$
                        Odd, they match your code above, for me. I switched between the two images and saw no (perceptible) difference.
                        $endgroup$
                        – Michael E2
                        Jan 14 at 23:02












                      • $begingroup$
                        @MichaelE2, maybe version/os difference (i am using v 11.3 windows 10/64bit).
                        $endgroup$
                        – kglr
                        Jan 14 at 23:04










                      • $begingroup$
                        @MichaelE2, ColorFunction -> "Rainbow" does work if the first argument of StreamDensityPlot has the form ${{v_x, v_y}, s }$.
                        $endgroup$
                        – kglr
                        Jan 15 at 1:39














                      8












                      8








                      8





                      $begingroup$

                      You can use StreamDensityPlot (which accepts the ColorFunction option) to produce the texture:



                      sdp = StreamDensityPlot[Evaluate[{-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}], 
                      (x^2 + y^2) Exp[1 - x^2 - y^2]}], {x, -3, 3}, {y, -3, 3},
                      StreamStyle -> Black,
                      ColorFunction -> "Rainbow",
                      ColorFunctionScaling -> False, Frame -> False, Axes -> False,
                      PlotRangePadding -> None];
                      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3},
                      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
                      PlotStyle -> Texture[Lighter@sdp], Lighting -> "Neutral"]


                      enter image description here






                      share|improve this answer











                      $endgroup$



                      You can use StreamDensityPlot (which accepts the ColorFunction option) to produce the texture:



                      sdp = StreamDensityPlot[Evaluate[{-D[(x^2 + y^2) Exp[1 - x^2 - y^2], {{x, y}}], 
                      (x^2 + y^2) Exp[1 - x^2 - y^2]}], {x, -3, 3}, {y, -3, 3},
                      StreamStyle -> Black,
                      ColorFunction -> "Rainbow",
                      ColorFunctionScaling -> False, Frame -> False, Axes -> False,
                      PlotRangePadding -> None];
                      Plot3D[(x^2 + y^2) Exp[1 - x^2 - y^2], {x, -3, 3}, {y, -3, 3},
                      Mesh -> None, ImageSize -> Large, PlotPoints -> 35,
                      PlotStyle -> Texture[Lighter@sdp], Lighting -> "Neutral"]


                      enter image description here







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 15 at 1:36

























                      answered Jan 14 at 20:56









                      kglrkglr

                      180k9200413




                      180k9200413












                      • $begingroup$
                        Slightly shorter: sdp = StreamDensityPlot[ Evaluate[{-D[#, {{x, y}}], #} &[(x^2 + y^2) Exp[ 1 - x^2 - y^2]]], {x, -3, 3}, {y, -3, 3}, StreamStyle -> Black, ColorFunction -> "Rainbow", Frame -> False, Axes -> False, PlotRangePadding -> None];
                        $endgroup$
                        – Michael E2
                        Jan 14 at 21:55










                      • $begingroup$
                        @MichaelE2, I tried that version; but the colors do not match the colors in Plot3D.
                        $endgroup$
                        – kglr
                        Jan 14 at 23:01










                      • $begingroup$
                        Odd, they match your code above, for me. I switched between the two images and saw no (perceptible) difference.
                        $endgroup$
                        – Michael E2
                        Jan 14 at 23:02












                      • $begingroup$
                        @MichaelE2, maybe version/os difference (i am using v 11.3 windows 10/64bit).
                        $endgroup$
                        – kglr
                        Jan 14 at 23:04










                      • $begingroup$
                        @MichaelE2, ColorFunction -> "Rainbow" does work if the first argument of StreamDensityPlot has the form ${{v_x, v_y}, s }$.
                        $endgroup$
                        – kglr
                        Jan 15 at 1:39


















                      • $begingroup$
                        Slightly shorter: sdp = StreamDensityPlot[ Evaluate[{-D[#, {{x, y}}], #} &[(x^2 + y^2) Exp[ 1 - x^2 - y^2]]], {x, -3, 3}, {y, -3, 3}, StreamStyle -> Black, ColorFunction -> "Rainbow", Frame -> False, Axes -> False, PlotRangePadding -> None];
                        $endgroup$
                        – Michael E2
                        Jan 14 at 21:55










                      • $begingroup$
                        @MichaelE2, I tried that version; but the colors do not match the colors in Plot3D.
                        $endgroup$
                        – kglr
                        Jan 14 at 23:01










                      • $begingroup$
                        Odd, they match your code above, for me. I switched between the two images and saw no (perceptible) difference.
                        $endgroup$
                        – Michael E2
                        Jan 14 at 23:02












                      • $begingroup$
                        @MichaelE2, maybe version/os difference (i am using v 11.3 windows 10/64bit).
                        $endgroup$
                        – kglr
                        Jan 14 at 23:04










                      • $begingroup$
                        @MichaelE2, ColorFunction -> "Rainbow" does work if the first argument of StreamDensityPlot has the form ${{v_x, v_y}, s }$.
                        $endgroup$
                        – kglr
                        Jan 15 at 1:39
















                      $begingroup$
                      Slightly shorter: sdp = StreamDensityPlot[ Evaluate[{-D[#, {{x, y}}], #} &[(x^2 + y^2) Exp[ 1 - x^2 - y^2]]], {x, -3, 3}, {y, -3, 3}, StreamStyle -> Black, ColorFunction -> "Rainbow", Frame -> False, Axes -> False, PlotRangePadding -> None];
                      $endgroup$
                      – Michael E2
                      Jan 14 at 21:55




                      $begingroup$
                      Slightly shorter: sdp = StreamDensityPlot[ Evaluate[{-D[#, {{x, y}}], #} &[(x^2 + y^2) Exp[ 1 - x^2 - y^2]]], {x, -3, 3}, {y, -3, 3}, StreamStyle -> Black, ColorFunction -> "Rainbow", Frame -> False, Axes -> False, PlotRangePadding -> None];
                      $endgroup$
                      – Michael E2
                      Jan 14 at 21:55












                      $begingroup$
                      @MichaelE2, I tried that version; but the colors do not match the colors in Plot3D.
                      $endgroup$
                      – kglr
                      Jan 14 at 23:01




                      $begingroup$
                      @MichaelE2, I tried that version; but the colors do not match the colors in Plot3D.
                      $endgroup$
                      – kglr
                      Jan 14 at 23:01












                      $begingroup$
                      Odd, they match your code above, for me. I switched between the two images and saw no (perceptible) difference.
                      $endgroup$
                      – Michael E2
                      Jan 14 at 23:02






                      $begingroup$
                      Odd, they match your code above, for me. I switched between the two images and saw no (perceptible) difference.
                      $endgroup$
                      – Michael E2
                      Jan 14 at 23:02














                      $begingroup$
                      @MichaelE2, maybe version/os difference (i am using v 11.3 windows 10/64bit).
                      $endgroup$
                      – kglr
                      Jan 14 at 23:04




                      $begingroup$
                      @MichaelE2, maybe version/os difference (i am using v 11.3 windows 10/64bit).
                      $endgroup$
                      – kglr
                      Jan 14 at 23:04












                      $begingroup$
                      @MichaelE2, ColorFunction -> "Rainbow" does work if the first argument of StreamDensityPlot has the form ${{v_x, v_y}, s }$.
                      $endgroup$
                      – kglr
                      Jan 15 at 1:39




                      $begingroup$
                      @MichaelE2, ColorFunction -> "Rainbow" does work if the first argument of StreamDensityPlot has the form ${{v_x, v_y}, s }$.
                      $endgroup$
                      – kglr
                      Jan 15 at 1:39











                      2












                      $begingroup$

                      PlotStyle -> Texture[...] relies on VertexTextureCoordinates to map the texture to polygon vertices.



                      ColorFunction -> colorfunction relies on VertexColors to associate colors with the polygon vertices.



                      Only one of them actually gets to style the polygon. In my case, it seems to be the texture:



                      Graphics3D[{Texture[RandomImage[1, 100]], 
                      Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}},
                      VertexColors -> {Red, Green, Blue},
                      VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}}]},
                      Lighting -> "Neutral", BoxRatios -> {1, 1, 1}]


                      enter image description here



                      It sounds like the color function is winning in your case. It wouldn't surprise me if that was dependent on things like OS, software version, phase of the moon, etc...






                      share|improve this answer









                      $endgroup$


















                        2












                        $begingroup$

                        PlotStyle -> Texture[...] relies on VertexTextureCoordinates to map the texture to polygon vertices.



                        ColorFunction -> colorfunction relies on VertexColors to associate colors with the polygon vertices.



                        Only one of them actually gets to style the polygon. In my case, it seems to be the texture:



                        Graphics3D[{Texture[RandomImage[1, 100]], 
                        Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}},
                        VertexColors -> {Red, Green, Blue},
                        VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}}]},
                        Lighting -> "Neutral", BoxRatios -> {1, 1, 1}]


                        enter image description here



                        It sounds like the color function is winning in your case. It wouldn't surprise me if that was dependent on things like OS, software version, phase of the moon, etc...






                        share|improve this answer









                        $endgroup$
















                          2












                          2








                          2





                          $begingroup$

                          PlotStyle -> Texture[...] relies on VertexTextureCoordinates to map the texture to polygon vertices.



                          ColorFunction -> colorfunction relies on VertexColors to associate colors with the polygon vertices.



                          Only one of them actually gets to style the polygon. In my case, it seems to be the texture:



                          Graphics3D[{Texture[RandomImage[1, 100]], 
                          Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}},
                          VertexColors -> {Red, Green, Blue},
                          VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}}]},
                          Lighting -> "Neutral", BoxRatios -> {1, 1, 1}]


                          enter image description here



                          It sounds like the color function is winning in your case. It wouldn't surprise me if that was dependent on things like OS, software version, phase of the moon, etc...






                          share|improve this answer









                          $endgroup$



                          PlotStyle -> Texture[...] relies on VertexTextureCoordinates to map the texture to polygon vertices.



                          ColorFunction -> colorfunction relies on VertexColors to associate colors with the polygon vertices.



                          Only one of them actually gets to style the polygon. In my case, it seems to be the texture:



                          Graphics3D[{Texture[RandomImage[1, 100]], 
                          Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}},
                          VertexColors -> {Red, Green, Blue},
                          VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}}]},
                          Lighting -> "Neutral", BoxRatios -> {1, 1, 1}]


                          enter image description here



                          It sounds like the color function is winning in your case. It wouldn't surprise me if that was dependent on things like OS, software version, phase of the moon, etc...







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 14 at 20:13









                          Brett ChampionBrett Champion

                          17.3k252114




                          17.3k252114






























                              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%2f189485%2fcant-blend-gradient-colors-with-a-stream%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

                              Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                              ComboBox Display Member on multiple fields

                              Is it possible to collect Nectar points via Trainline?