Use of colours with Brewermap

조회 수: 39 (최근 30일)
A_V_G
A_V_G 2018년 11월 28일
편집: A_V_G 2018년 11월 28일
Hi,
I would like to use the colours "Purples" in my plot where I have 3 lines. However, if I write in the code
set(0, 'DefaultAxesColorOrder', brewermap(3, 'BuPu'))
it will show the first, middel and last colourschemes. I want the last 3, thus, the darkest purples.
Any help with this?
Thanks in advance!
  댓글 수: 1
Adam
Adam 2018년 11월 28일
편집: Adam 2018년 11월 28일
I don't use brewerMap so I don't know its allowed calling syntaxes, but I would imagine you need to first create a colourmap of the size from which you wish to select the final 3 and then just use the final 3 from that resulting colourmap. If you just ask for 3 colours it will give the first the last and then one interpolated in the middle. If you ask for 256 it will give the first, the last and 254 interpolated between those. There is no fixed 'last 3 colours' for a colourmap though, in general, it all depends how fine or coarse a colourmap you create as to what the 'last 3' colours are.

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

채택된 답변

Stephen23
Stephen23 2018년 11월 28일
편집: Stephen23 2018년 11월 28일
I guess you are referring to my FEX submission brewermap:
All colormap functions that I have seen return the entire colormap, which you can easily index into yourself:
map = brewermap(9,'BuPu');
set(0, 'DefaultAxesColorOrder', map(1:3,:)) % first three rows
set(0, 'DefaultAxesColorOrder', map(end-2:end,:)) % last three rows
Note that all of ColorBrewer's sequential colorschemes are defined with nine nodes. You can return the colormap in reverse order by prefixing an asterisk to the colorscheme name, e.g. '*PuBu'. You might find that useful to get the correct order of colors that you need.
  댓글 수: 1
A_V_G
A_V_G 2018년 11월 28일
편집: A_V_G 2018년 11월 28일
Great, it works!
Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by