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

Go to the source code of this file.

Functions

function bwr (in nell, in clim)
 Return a blue-white-red colormap matrix of shape (nell, 3) containing the RGB values with white corresponding to the CAXIS value closest to zero.
More...
 

Function Documentation

◆ bwr()

function bwr ( in  nell,
in  clim 
)

Return a blue-white-red colormap matrix of shape (nell, 3) containing the RGB values with white corresponding to the CAXIS value closest to zero.

Note
This colormap is most useful for images and surface plots with positive and negative values.
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))
[in]clim: The input vector length 2 of MATLAB doubles representing the color limits of the output colormap.
(optional, default = get(gca, 'CLim'))
Returns
cmap : The output blue-white-red colormap matrix of shape [nell, 3] containing a cold colormap.


Possible calling interfaces

cmap = pm.vis.cmap.cold()
cmap = pm.vis.cmap.cold([])
cmap = pm.vis.cmap.cold(nell)
See also
MATLAB intrinsic functions hsv(), hot(), cool(), bone(), copper(), pink(), flag(), colormap(), rgbplot().


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.bwr(256));
7colorbar;
8pm.vis.figure.savefig("bwr.1.png", "-m3");
9
10figure("color", "white");
11imagesc(peaks(500), [0, 8]);
12colormap(pm.vis.cmap.bwr());
13colorbar;
14pm.vis.figure.savefig("bwr.2.png", "-m3");
15
16figure("color", "white");
17imagesc(peaks(250), [-6, 0]);
18colormap(pm.vis.cmap.bwr());
19colorbar;
20pm.vis.figure.savefig("bwr.3.png", "-m3");
21
22figure("color", "white");
23surf(peaks);
24colormap(pm.vis.cmap.bwr());
25axis("tight");
26pm.vis.figure.savefig("bwr.4.png", "-m3");
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.

Visualization of the example output


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.

Copyright (c) 2009, Nathan Childress 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:40 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