What is the color spec for default blue?

조회 수: 203 (최근 30일)
Brando Miranda
Brando Miranda 2018년 7월 15일
답변: Image Analyst 2018년 7월 15일
i.e. this blue:
----
I tried:
c = repelem([0 0.4470 0.7410],length(X),1);
%scatter(X,Y,c)
scatter(X,Y,[0 0.4470 0.7410])
but if fails with message:
Error using scatter (line 76)
S must be a scalar or a vector of the same length as X.
Error in scaling_experiment_loss_vs_gen_errosr_normalization (line 65)
scatter(X,Y,[0 0.4470 0.7410])

답변 (3개)

Jan
Jan 2018년 7월 15일
편집: Jan 2018년 7월 15일
It depends on what you call "color spec".
figure,
axes;
LineH = plot(rand(1, 10), 'o')
get(LineH, 'Color')
>> [0 0.4470 0.7410]
Or maybe you mean:
plot(1:10, rand(1, 10), 'b')
^^^
? If this does not help, please edit the question and add more details.
  댓글 수: 3
Brando Miranda
Brando Miranda 2018년 7월 15일
c = repelem([0 0.4470 0.7410],length(X),1);
scatter(X,Y)
fails
Jan
Jan 2018년 7월 15일
편집: Jan 2018년 7월 15일
"fails" does not allow to understand, what you observe. "c" is not used in your scatter command. So perhaps this is a typo only?
X = 1:10;
Y = rand(1, 10);
c = repelem([0 0.4470 0.7410],length(X),1);
scatter(X, Y, [], c)
Works under R2016b.

댓글을 달려면 로그인하십시오.


Brando Miranda
Brando Miranda 2018년 7월 15일
c = [0 0.4470 0.7410];
scatter(X,Y,'MarkerEdgeColor',c)
finally worked
  댓글 수: 1
Brando Miranda
Brando Miranda 2018년 7월 15일
h = scatter(X,Y)
c = get(h,'Color')
c{1}
c{2}

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2018년 7월 15일
You can get all the default colors like this:
% Get the initial set of default plot colors.
initialColorOrder = get(gca,'ColorOrder') % Initial
You can change that order, and my attached demo shows you how.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by