Filling an area below a curve with a colormap defined by the function of the curvehow to get vertical gradient fill in matlab plotPlot Shaded Area Between Two User-Defined Lines and Beneath Preexisting DataMatlab: contourf or colormap to plot filled ellipses according to radiusMatlab Area Plot: Adjusting box style and tick marksHow do I plot one curve with two different units (y-axes) in the same plot window in MATLAB?How to shade area between horizontal line and curve in Matlab plotArea between line and curve (no function)Matlab - try to get the same curve with Matlab numerical function and ezplotPyhon - Fill under curve, based on the value of the functionPython Matplotlib - Filling Area Between Two Concentric Circles

Joist hangers to use for rough cut 2x8 (2 3/4" x 8 3/4")?

Asking bank to reduce APR instead of increasing credit limit

What is the intuition behind uniform continuity?

What is a simple, physical situation where complex numbers emerge naturally?

How can I offer a test ride while selling a bike?

Singlequote and backslash

How can I grammatically understand "Wir über uns"?

What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?

The oldest tradition stopped before it got back to him

Beginner's snake game using PyGame

Select row of data if next row contains zero

The most awesome army: 80 men left and 81 returned. Is it true?

What is a natural deduction proof from ~(A↔B) to ~(A→B)?

Are there regional foods in Westeros?

How to decline physical affection from a child whose parents are pressuring them?

Did airlines fly their aircraft slower in response to oil prices in the 1970s?

What does the behaviour of water on the skin of an aircraft in flight tell us?

What should I do about a religious player who refuses to accept the existence of multiple gods in D&D?

Do adult Russians normally hand-write Cyrillic as cursive or as block letters?

Modern approach to radio buttons

Why would Lupin kill Pettigrew?

How can an eldritch abomination hide its true form in public?

Looking after a wayward brother in mother's will

Is the world in Game of Thrones spherical or flat?



Filling an area below a curve with a colormap defined by the function of the curve


how to get vertical gradient fill in matlab plotPlot Shaded Area Between Two User-Defined Lines and Beneath Preexisting DataMatlab: contourf or colormap to plot filled ellipses according to radiusMatlab Area Plot: Adjusting box style and tick marksHow do I plot one curve with two different units (y-axes) in the same plot window in MATLAB?How to shade area between horizontal line and curve in Matlab plotArea between line and curve (no function)Matlab - try to get the same curve with Matlab numerical function and ezplotPyhon - Fill under curve, based on the value of the functionPython Matplotlib - Filling Area Between Two Concentric Circles






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Consider the following plot:



enter image description here



On the left you can see the fill of a circle with respect to a profile of a function using patch command



t = linspace(-pi,pi,100);
c = exp(-cos(t));
figure(1)
patch(cos(t),sin(t),c)
axis equal


On the right you see the profile of the function along the dashed line axis on the left, which is filled using the area command.



figure(2)
area(cos(t),c,0);


what I'm trying to do is fill the area below the curve (right panel) with the colors defined by the colormap of the representation in the left panel. The results should look like this
enter image description here










share|improve this question






























    0















    Consider the following plot:



    enter image description here



    On the left you can see the fill of a circle with respect to a profile of a function using patch command



    t = linspace(-pi,pi,100);
    c = exp(-cos(t));
    figure(1)
    patch(cos(t),sin(t),c)
    axis equal


    On the right you see the profile of the function along the dashed line axis on the left, which is filled using the area command.



    figure(2)
    area(cos(t),c,0);


    what I'm trying to do is fill the area below the curve (right panel) with the colors defined by the colormap of the representation in the left panel. The results should look like this
    enter image description here










    share|improve this question


























      0












      0








      0








      Consider the following plot:



      enter image description here



      On the left you can see the fill of a circle with respect to a profile of a function using patch command



      t = linspace(-pi,pi,100);
      c = exp(-cos(t));
      figure(1)
      patch(cos(t),sin(t),c)
      axis equal


      On the right you see the profile of the function along the dashed line axis on the left, which is filled using the area command.



      figure(2)
      area(cos(t),c,0);


      what I'm trying to do is fill the area below the curve (right panel) with the colors defined by the colormap of the representation in the left panel. The results should look like this
      enter image description here










      share|improve this question
















      Consider the following plot:



      enter image description here



      On the left you can see the fill of a circle with respect to a profile of a function using patch command



      t = linspace(-pi,pi,100);
      c = exp(-cos(t));
      figure(1)
      patch(cos(t),sin(t),c)
      axis equal


      On the right you see the profile of the function along the dashed line axis on the left, which is filled using the area command.



      figure(2)
      area(cos(t),c,0);


      what I'm trying to do is fill the area below the curve (right panel) with the colors defined by the colormap of the representation in the left panel. The results should look like this
      enter image description here







      matlab plot colors matlab-figure area






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 13:17









      Dev-iL

      18.4k64579




      18.4k64579










      asked Mar 24 at 10:44









      jarheadjarhead

      62541436




      62541436






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The closest thing I could come up with is this:



          function q55322965
          % Evaluate the equation (half domain!)
          t = linspace(-pi,0,50);
          c = exp(-cos(t));

          % Turn vectors into a mesh:
          [TT,CC] = meshgrid(cos(t),c);

          % Clear all points that are above the curve:
          CC(CC > c) = NaN;

          % Fill in the rectangle between the chart and zero:
          CC(end+1,:) = 0;
          TT(end+1,:) = TT(end,:);

          % Plot:
          figure(); mesh(TT,CC,CC,'FaceColor','interp','EdgeColor','interp'); view([0,90]);


          Which yields:



          enter image description here



          If you want a less jagged look when plotting with this method, you can increase the resolution in t. For example, if we use 500 instead of 50 in the linspace we get:



          enter image description here






          share|improve this answer

























          • why did you choose only half of the domain and not the full range [-pi,pi]?

            – jarhead
            Mar 24 at 15:16











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fstackoverflow.com%2fquestions%2f55322965%2ffilling-an-area-below-a-curve-with-a-colormap-defined-by-the-function-of-the-cur%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









          1














          The closest thing I could come up with is this:



          function q55322965
          % Evaluate the equation (half domain!)
          t = linspace(-pi,0,50);
          c = exp(-cos(t));

          % Turn vectors into a mesh:
          [TT,CC] = meshgrid(cos(t),c);

          % Clear all points that are above the curve:
          CC(CC > c) = NaN;

          % Fill in the rectangle between the chart and zero:
          CC(end+1,:) = 0;
          TT(end+1,:) = TT(end,:);

          % Plot:
          figure(); mesh(TT,CC,CC,'FaceColor','interp','EdgeColor','interp'); view([0,90]);


          Which yields:



          enter image description here



          If you want a less jagged look when plotting with this method, you can increase the resolution in t. For example, if we use 500 instead of 50 in the linspace we get:



          enter image description here






          share|improve this answer

























          • why did you choose only half of the domain and not the full range [-pi,pi]?

            – jarhead
            Mar 24 at 15:16















          1














          The closest thing I could come up with is this:



          function q55322965
          % Evaluate the equation (half domain!)
          t = linspace(-pi,0,50);
          c = exp(-cos(t));

          % Turn vectors into a mesh:
          [TT,CC] = meshgrid(cos(t),c);

          % Clear all points that are above the curve:
          CC(CC > c) = NaN;

          % Fill in the rectangle between the chart and zero:
          CC(end+1,:) = 0;
          TT(end+1,:) = TT(end,:);

          % Plot:
          figure(); mesh(TT,CC,CC,'FaceColor','interp','EdgeColor','interp'); view([0,90]);


          Which yields:



          enter image description here



          If you want a less jagged look when plotting with this method, you can increase the resolution in t. For example, if we use 500 instead of 50 in the linspace we get:



          enter image description here






          share|improve this answer

























          • why did you choose only half of the domain and not the full range [-pi,pi]?

            – jarhead
            Mar 24 at 15:16













          1












          1








          1







          The closest thing I could come up with is this:



          function q55322965
          % Evaluate the equation (half domain!)
          t = linspace(-pi,0,50);
          c = exp(-cos(t));

          % Turn vectors into a mesh:
          [TT,CC] = meshgrid(cos(t),c);

          % Clear all points that are above the curve:
          CC(CC > c) = NaN;

          % Fill in the rectangle between the chart and zero:
          CC(end+1,:) = 0;
          TT(end+1,:) = TT(end,:);

          % Plot:
          figure(); mesh(TT,CC,CC,'FaceColor','interp','EdgeColor','interp'); view([0,90]);


          Which yields:



          enter image description here



          If you want a less jagged look when plotting with this method, you can increase the resolution in t. For example, if we use 500 instead of 50 in the linspace we get:



          enter image description here






          share|improve this answer















          The closest thing I could come up with is this:



          function q55322965
          % Evaluate the equation (half domain!)
          t = linspace(-pi,0,50);
          c = exp(-cos(t));

          % Turn vectors into a mesh:
          [TT,CC] = meshgrid(cos(t),c);

          % Clear all points that are above the curve:
          CC(CC > c) = NaN;

          % Fill in the rectangle between the chart and zero:
          CC(end+1,:) = 0;
          TT(end+1,:) = TT(end,:);

          % Plot:
          figure(); mesh(TT,CC,CC,'FaceColor','interp','EdgeColor','interp'); view([0,90]);


          Which yields:



          enter image description here



          If you want a less jagged look when plotting with this method, you can increase the resolution in t. For example, if we use 500 instead of 50 in the linspace we get:



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 24 at 13:13

























          answered Mar 24 at 12:55









          Dev-iLDev-iL

          18.4k64579




          18.4k64579












          • why did you choose only half of the domain and not the full range [-pi,pi]?

            – jarhead
            Mar 24 at 15:16

















          • why did you choose only half of the domain and not the full range [-pi,pi]?

            – jarhead
            Mar 24 at 15:16
















          why did you choose only half of the domain and not the full range [-pi,pi]?

          – jarhead
          Mar 24 at 15:16





          why did you choose only half of the domain and not the full range [-pi,pi]?

          – jarhead
          Mar 24 at 15:16

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • 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.

          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%2fstackoverflow.com%2fquestions%2f55322965%2ffilling-an-area-below-a-curve-with-a-colormap-defined-by-the-function-of-the-cur%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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript