I have two 1D vectors of the same length, data
and my_parameter
. I use probplot
to see the probability plot for data, as follows:
h = probplot(gca, data);
% in next line, want color based on my_parameter, not static color as used.
set(h, 'color', [0.5 0.5 0.5]);
set(h, 'marker', '.');
I would like to color by my_parameter
, the goal being to see whether certain values of my_parameter
throw off the normality of the distribution. Is there a way to use a color scale, eg, parula
, in conjunction with the probplot function?
I have tried:
[0.5 0.5 0.5]
with 'parula'
. [0.5 0.5 0.5]
with parula
. [0.5 0.5 0.5]
with a m-row 3-column double matrix, where each row has the rgb values that parula
would map my_parameter
to. (So m is the length of my_parameter
.) set(h, 'color', [0.5 0.5 0.5]);
, and adding a line colormap(parula);
below the set lines. If there is not a way to do this using the probplot
function directly because of how it is written (eg if it is written to accept only 3-element vectors), I guess I'll have to try to rewrite my own version of probplot
using one of the scatter
functions. I could dig around and figure this out, but before I start doing this, could anyone point me to a resource where this is done already perchance?
Thanks for any help.
Try this:
x=rand(1,15); % dummy data to plot
probplot(x)
h = probplot(gca,x);
c = parula(10);
% this changes the color of the 'x' marks to be the first row of the parula matrix
h(1).Color = c(1,:);
% this changes the color of the dashed line to be the 9th row of the parula matrix
h(2).Color = c(9,:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.