using a viridis colormap

조회 수: 278 (최근 30일)
Wissem
Wissem 2022년 2월 21일
댓글: Nidia Maldonado Carmona 2022년 3월 28일
Hello everyone,
I would like to know how is it possible to use properly a viridis colormap in order to draw scatter figures. For instance, i have this figure to plot :
figure(2)
plot(x1,y1,'^r','MarkerSize',8,'MarkerFaceColor','r')
% plot(x1,y1,'^r','MarkerSize',8,'MarkerFaceColor',viridis(5))
xlabel('F_{vis}')
ylabel('F_{flambement}','FontSize',13)
But I don't know how to use this "alternative" colormap since I am not familiar with this function in this case.
Could someone help please ?
Thank you in advance.
Sincerely.

채택된 답변

Image Analyst
Image Analyst 2022년 2월 21일
See attached demos where I show you how you can replace the default color order of plots and markers with some custom colormap of your own creation.
  댓글 수: 1
Nidia Maldonado Carmona
Nidia Maldonado Carmona 2022년 3월 28일
Thanks a lot for this! This has been really helpful!

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

추가 답변 (2개)

DGM
DGM 2022년 2월 21일
편집: DGM 2022년 2월 21일
Use scatter() instead of plot(). The behavior of viridis() is otherwise the same as the built-in functions like jet().
N = 20;
x1 = randn(N,1);
y1 = randn(N,1);
scatter(x1,y1,50,viridis(N),'filled','^')
  댓글 수: 5
Wissem
Wissem 2022년 2월 21일
Yes you are right : I totally missed this argument. However, I am still unable to use this command since the viridis function is not recognized despite the fact that it's added to my current path. I don't understand why it doesn't work : I am going to check again for the path directory.
Stephen23
Stephen23 2022년 2월 21일
@Wissem-Eddine KHATLA: you can also place it into the current directory, which may be easier.

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


Wissem
Wissem 2022년 2월 23일
Thank you all for your help : I really got what I was looking for !
Thanks again !

카테고리

Help CenterFile Exchange에서 Color and Styling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by