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;
Consider the following plot:
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
matlab plot colors matlab-figure area
add a comment |
Consider the following plot:
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
matlab plot colors matlab-figure area
add a comment |
Consider the following plot:
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
matlab plot colors matlab-figure area
Consider the following plot:
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
matlab plot colors matlab-figure area
matlab plot colors matlab-figure area
edited Mar 24 at 13:17
Dev-iL
18.4k64579
18.4k64579
asked Mar 24 at 10:44
jarheadjarhead
62541436
62541436
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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:
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:
why did you choose only half of the domain and not the full range [-pi,pi]?
– jarhead
Mar 24 at 15:16
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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:
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:
why did you choose only half of the domain and not the full range [-pi,pi]?
– jarhead
Mar 24 at 15:16
add a comment |
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:
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:
why did you choose only half of the domain and not the full range [-pi,pi]?
– jarhead
Mar 24 at 15:16
add a comment |
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:
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:
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:
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:
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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