Obtaining the percentile 95 of a matrix and then plotting it3d plots in matlab based on a matrixMATLAB — How does one plot a heatmap from nxn matrix?Heatmap or plot for a correlation matrixHow to be able to plot Matrix and the mean of matrix in Matlab?Line plot of rows in a Matlab matrix with the x-axis is the maximum valueQuiver from a single matrixHow do you plot the 3-D plot for pcolor style using one matrix with varying one variable along Z-axis?redblue colormap with transition period at zeroFinding local minima about either side of a maxima in a matrix in matlabHow to rotate X Labels in MATLAB R2014a using edit tool?
What does “the session was packed” mean in this context?
How seriously should I take size and weight limits of hand luggage?
Should I tell management that I intend to leave due to bad software development practices?
Mathematica command that allows it to read my intentions
Do scales need to be in alphabetical order?
One verb to replace 'be a member of' a club
Why do bosons tend to occupy the same state?
All in one piece, we mend holes in your socks
What is a romance in Latin?
What do you call someone who asks many questions?
Size of subfigure fitting its content (tikzpicture)
Is "remove commented out code" correct English?
Why didn't Miles's spider sense work before?
How much of data wrangling is a data scientist's job?
Detention in 1997
Can my sorcerer use a spellbook only to collect spells and scribe scrolls, not cast?
What killed these X2 caps?
Could the museum Saturn V's be refitted for one more flight?
Venezuelan girlfriend wants to travel the USA to be with me. What is the process?
Is it inappropriate for a student to attend their mentor's dissertation defense?
Watching something be piped to a file live with tail
Assassin's bullet with mercury
Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?
Why is this clock signal connected to a capacitor to gnd?
Obtaining the percentile 95 of a matrix and then plotting it
3d plots in matlab based on a matrixMATLAB — How does one plot a heatmap from nxn matrix?Heatmap or plot for a correlation matrixHow to be able to plot Matrix and the mean of matrix in Matlab?Line plot of rows in a Matlab matrix with the x-axis is the maximum valueQuiver from a single matrixHow do you plot the 3-D plot for pcolor style using one matrix with varying one variable along Z-axis?redblue colormap with transition period at zeroFinding local minima about either side of a maxima in a matrix in matlabHow to rotate X Labels in MATLAB R2014a using edit tool?
EDIT:
I have been asked to add more detail. Originally I have a 360x180 matrix, and in it there are data of E-P values, these values stand for Evaporation (E) and Precipitation (P), and they basically indicate sources (E-P>0) and sinks(E-P<0) of moisture. In order to obtain the most important sources of moisture I have to take only the positive values, and I want to obtain the percentile 95 of these values, then plot the values which are above this threshold, since I wanted to do a reproducible example I used the peaks
data:
I have done this in MATLAB but if it can be made on R it works for me as well.
I have an example 49x49 matrix like this:
a = peaks;
pcolor(a);
caxis([-10 10]);
cbh=colorbar('v');
set(cbh,'YTick',(-10:1:10))
And it shows something like this
What I want to do is to obtain the percentile 95 of only the positive values, and then plotting them.
How can I do this? and also, what would it be better: To replace all the values less than zero with 0's or Nan's??
r matlab statistics quantile
add a comment |
EDIT:
I have been asked to add more detail. Originally I have a 360x180 matrix, and in it there are data of E-P values, these values stand for Evaporation (E) and Precipitation (P), and they basically indicate sources (E-P>0) and sinks(E-P<0) of moisture. In order to obtain the most important sources of moisture I have to take only the positive values, and I want to obtain the percentile 95 of these values, then plot the values which are above this threshold, since I wanted to do a reproducible example I used the peaks
data:
I have done this in MATLAB but if it can be made on R it works for me as well.
I have an example 49x49 matrix like this:
a = peaks;
pcolor(a);
caxis([-10 10]);
cbh=colorbar('v');
set(cbh,'YTick',(-10:1:10))
And it shows something like this
What I want to do is to obtain the percentile 95 of only the positive values, and then plotting them.
How can I do this? and also, what would it be better: To replace all the values less than zero with 0's or Nan's??
r matlab statistics quantile
I have added more detail, hopping that it makes it more clear.
– Ann M
Mar 9 at 23:31
I think the question is clear now, voting to reopen.
– Cris Luengo
Mar 10 at 0:15
add a comment |
EDIT:
I have been asked to add more detail. Originally I have a 360x180 matrix, and in it there are data of E-P values, these values stand for Evaporation (E) and Precipitation (P), and they basically indicate sources (E-P>0) and sinks(E-P<0) of moisture. In order to obtain the most important sources of moisture I have to take only the positive values, and I want to obtain the percentile 95 of these values, then plot the values which are above this threshold, since I wanted to do a reproducible example I used the peaks
data:
I have done this in MATLAB but if it can be made on R it works for me as well.
I have an example 49x49 matrix like this:
a = peaks;
pcolor(a);
caxis([-10 10]);
cbh=colorbar('v');
set(cbh,'YTick',(-10:1:10))
And it shows something like this
What I want to do is to obtain the percentile 95 of only the positive values, and then plotting them.
How can I do this? and also, what would it be better: To replace all the values less than zero with 0's or Nan's??
r matlab statistics quantile
EDIT:
I have been asked to add more detail. Originally I have a 360x180 matrix, and in it there are data of E-P values, these values stand for Evaporation (E) and Precipitation (P), and they basically indicate sources (E-P>0) and sinks(E-P<0) of moisture. In order to obtain the most important sources of moisture I have to take only the positive values, and I want to obtain the percentile 95 of these values, then plot the values which are above this threshold, since I wanted to do a reproducible example I used the peaks
data:
I have done this in MATLAB but if it can be made on R it works for me as well.
I have an example 49x49 matrix like this:
a = peaks;
pcolor(a);
caxis([-10 10]);
cbh=colorbar('v');
set(cbh,'YTick',(-10:1:10))
And it shows something like this
What I want to do is to obtain the percentile 95 of only the positive values, and then plotting them.
How can I do this? and also, what would it be better: To replace all the values less than zero with 0's or Nan's??
r matlab statistics quantile
r matlab statistics quantile
edited Mar 9 at 23:30
Ann M
asked Mar 8 at 22:39
Ann MAnn M
9610
9610
I have added more detail, hopping that it makes it more clear.
– Ann M
Mar 9 at 23:31
I think the question is clear now, voting to reopen.
– Cris Luengo
Mar 10 at 0:15
add a comment |
I have added more detail, hopping that it makes it more clear.
– Ann M
Mar 9 at 23:31
I think the question is clear now, voting to reopen.
– Cris Luengo
Mar 10 at 0:15
I have added more detail, hopping that it makes it more clear.
– Ann M
Mar 9 at 23:31
I have added more detail, hopping that it makes it more clear.
– Ann M
Mar 9 at 23:31
I think the question is clear now, voting to reopen.
– Cris Luengo
Mar 10 at 0:15
I think the question is clear now, voting to reopen.
– Cris Luengo
Mar 10 at 0:15
add a comment |
1 Answer
1
active
oldest
votes
If you have the statistics toolbox, you can use the function prctile
to obtain a percentile. I don't have this toolbox, so I wrote my own version (a long time ago) based on the code for the function median
. With either prctile
or percentile
you can do:
a = peaks;
t = percentile(a(a>0),95);
b = a > t;
subplot(1,2,1)
pcolor(a);
subplot(1,2,2)
pcolor(b);
a(a>0)
is a vector with all the positive values in a
. t
is the 95th percentile of this vector.
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%2f55071984%2fobtaining-the-percentile-95-of-a-matrix-and-then-plotting-it%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
If you have the statistics toolbox, you can use the function prctile
to obtain a percentile. I don't have this toolbox, so I wrote my own version (a long time ago) based on the code for the function median
. With either prctile
or percentile
you can do:
a = peaks;
t = percentile(a(a>0),95);
b = a > t;
subplot(1,2,1)
pcolor(a);
subplot(1,2,2)
pcolor(b);
a(a>0)
is a vector with all the positive values in a
. t
is the 95th percentile of this vector.
add a comment |
If you have the statistics toolbox, you can use the function prctile
to obtain a percentile. I don't have this toolbox, so I wrote my own version (a long time ago) based on the code for the function median
. With either prctile
or percentile
you can do:
a = peaks;
t = percentile(a(a>0),95);
b = a > t;
subplot(1,2,1)
pcolor(a);
subplot(1,2,2)
pcolor(b);
a(a>0)
is a vector with all the positive values in a
. t
is the 95th percentile of this vector.
add a comment |
If you have the statistics toolbox, you can use the function prctile
to obtain a percentile. I don't have this toolbox, so I wrote my own version (a long time ago) based on the code for the function median
. With either prctile
or percentile
you can do:
a = peaks;
t = percentile(a(a>0),95);
b = a > t;
subplot(1,2,1)
pcolor(a);
subplot(1,2,2)
pcolor(b);
a(a>0)
is a vector with all the positive values in a
. t
is the 95th percentile of this vector.
If you have the statistics toolbox, you can use the function prctile
to obtain a percentile. I don't have this toolbox, so I wrote my own version (a long time ago) based on the code for the function median
. With either prctile
or percentile
you can do:
a = peaks;
t = percentile(a(a>0),95);
b = a > t;
subplot(1,2,1)
pcolor(a);
subplot(1,2,2)
pcolor(b);
a(a>0)
is a vector with all the positive values in a
. t
is the 95th percentile of this vector.
answered Mar 11 at 6:25
Cris LuengoCris Luengo
22.5k52253
22.5k52253
add a comment |
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%2f55071984%2fobtaining-the-percentile-95-of-a-matrix-and-then-plotting-it%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
I have added more detail, hopping that it makes it more clear.
– Ann M
Mar 9 at 23:31
I think the question is clear now, voting to reopen.
– Cris Luengo
Mar 10 at 0:15