ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
redblue.m File Reference

Go to the source code of this file.

Functions

function redblue (in nell)
 Return a blue-red colormap matrix of shape (nell, 3) containing a redblue colormap.
More...
 

Function Documentation

◆ redblue()

function redblue ( in  nell)

Return a blue-red colormap matrix of shape (nell, 3) containing a redblue colormap.

The colors begin with bright blue, range through shades of blue to white, and then through shades of red to bright red.
The output is the same length as the current figure colormap.
If no figure exists, MATLAB will create one.

Parameters
[in]nell: The input scalar MATLAB integer representing the number of elements (rows) of the output colormap matrix.
(optional, default = size(get(gcf, 'colormap'), 1))
Returns
cmap : The output blue-red colormap matrix of shape [nell, 3] containing a redblue colormap.


Possible calling interfaces

cmap = pm.vis.cmap.redblue()
cmap = pm.vis.cmap.redblue([])
cmap = pm.vis.cmap.redblue(nell)


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../../'); % Add the ParaMonte library root directory to the search path.
3
4figure("color", "white");
5imagesc(peaks(500));
6colormap(pm.vis.cmap.redblue(256));
7colorbar;
8pm.vis.figure.savefig("redblue.1.png", "-m3");
9
10figure("color", "white");
11load topo
12imagesc(0:360, -90:90, topo); axis("xy");
13colormap(pm.vis.cmap.redblue());
14colorbar;
15pm.vis.figure.savefig("redblue.2.png", "-m3");
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.

Visualization of the example output
See also
MATLAB intrinsic functions hsv(), gray(), hot(), bone(), copper(), pink(), flag(), colormap(), rgbplot().


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Adam Auton, 9th October 2009 Copyright (c) 2009, Adam Auton All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. in no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Author:
Joshua Alexander Osborne, May 21 2024, 7:44 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin