using a viridis colormap

353 views (last 30 days)
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 :
% plot(x1,y1,'^r','MarkerSize',8,'MarkerFaceColor',viridis(5))
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.

Accepted Answer

Image Analyst
Image Analyst on 21 Feb 2022
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 Comment
Nidia Maldonado Carmona
Nidia Maldonado Carmona on 28 Mar 2022
Thanks a lot for this! This has been really helpful!

Sign in to comment.

More Answers (2)

DGM on 21 Feb 2022
Edited: DGM on 21 Feb 2022
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);
Stephen23 on 21 Feb 2022
@Wissem-Eddine KHATLA: you can also place it into the current directory, which may be easier.

Sign in to comment.

Wissem-Eddine KHATLA
Wissem-Eddine KHATLA on 23 Feb 2022
Thank you all for your help : I really got what I was looking for !
Thanks again !


Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by