Mata library for brewscheme



libbrewscheme – compiles the libbrewscheme Mata library and displays this help file.

Syntax

libbrewscheme [, display replace size(integer) ]

Description

libbrewscheme wrapper used to compile libbrewscheme.mlib locally. This help file defines the objects and methods defined in the library.

Options

display is an optional argument to display this help file after compiling the Mata library.

replace is an optional argument used to overwrite an existing copy of the library.

size is an optional argument passed to mata mlib create to set the maximum number of members of the library.

Mata Object and Method Information

Colorblindness Type Class

An object type used in a way that is analogous to an interface class in Java.

Colorblindness Type Members

x a member variable used for transforming RGB values for different forms of color sight impairments.

y a member variable used for transforming RGB values for different forms of color sight impairments.

m a member variable containing the slope used for transforming RGB values for different forms of color sight impairments.

yint a member variable containing the intercept used for transforming RGB values for different forms of color sight impairments.

Colorblindness Type Methods

getConfuseX() method used to access/retrieve the x member variable.

getConfuseY() method used to access/retrieve the x member variable.

getConfuseM() method used to access/retrieve the x member variable.

getConfuseYint() method used to access/retrieve the x member variable.

setConfuseX() method used to set the x member variable.

setConfuseY() method used to set the y member variable.

setConfuseM() method used to set the slope member variable.

setConfuseYint() method used to set the intercept member variable.

Protanopia Class

An object inheriting from the cbtype class with data specific to red color blindness.

Protanopia Members

x 0.7465

y 0.2535

m 1.273463

yint -0.073894

Deuteranopia Class

An object inheriting from the cbtype class with data specific to green color blindness.

Deuteranopia Members

x 1.4

y -0.4

m 0.968437

yint 0.003331

Tritanopia Class

An object inheriting from the cbtype class with data specific to blue color blindness.

Tritanopia Members

x 0.1748

y 0.0

m 0.062921

yint 0.292119

Colorblindness Simulation Class

An object used to simulate RGB values under varying forms of color blindness.

Colorblindness Simulation Members - Private

types contains the name of the types of colorblindness.

typelabs contains strings used to label the RGB values for specific forms of color blindness.

inputR the red channel that will be transformed.

inputG the green channel that will be transformed.

inputB the blue channel that will be transformed.

amount a modifier that defaults to a value of 1.

gamma an adjustment for the gamma level when transforming RGB to XYZ colorspace.

invgamma an adjustment for the gamma level when transforming XYZ to RGB colorspace.

transformedRGB a matrix of RGB tuples containing the user.

specified value and any types of transforms requested.

protanope a Protanopia class object.

deuteranope a Deuteranopia class object.

tritanope a Tritanopia class object.

Colorblindness Simulation Methods

new() constructor method (cannot be called directly).

achromatopsia() a method to transform the user RGB members to simulate the color perceived by individuals with achromatopsia.

setR() method used to set the red channel parameter.

setG() method used to set the green channel parameter.

setB() method used to set the blue channel parameter.

setRGB() method used to set the red, green, and blue channel parameters simultaneously.

setAmount() method used to specify non-default ajustment amount parameter.

simulate() method used to transform user specified RGB values to simulate perception with varying forms of color blindness.

getR() method used to access the user specified value for the red channel.

getG() method used to access the user specified value for the green channel.

getB() method used to access the user specified value for the blue channel.

getGamma() method used to access the gamma correction value.

getInvGamma() method used to access the inverse-gamma correction value.

getConfuseX() method used to access the x member of cbtype class object.

getConfuseY() method used to access the y member of cbtype class object.

getConfuseM() method used to access the slope member of cbtype class object.

getConfuseYint() method used to access the intercept member of cbtype class object.

getAmount() method used to retrieve the adjustment amount parameter value.

condMax() method used to for scaling transformed RGB values from XYZ back to RGB colorspace.

getTypes() method used to retrieve list of color blindness type strings.

getTypeLabs() method used to retrieve list of color blindness type label strings.

getType() method used to retrieve a color blindness type string.

getTypeLab() method used to retrieve a color blindness type label string.

getTransformedRgbs() method used to retrieve all transformed RGB values.

getTransformedRgb() method used to retrieve a single transformed RGB value.

checkRange() method used to enforce RGB values stay in [0, 255].

getRgbString() method used to return a single transformed RGB string to Stata as a local macro.

getRgbStrings() method used to return all transformed RGB strings to Stata in local macros.

Wrappers

translateColor() a wrapper around the colorblind object that simulates the RGB arguments under all conditions of color sightedness impairment.

brewcolor class

This class loads the meta and colordb files to enable faster searching of local databases for specified RGB values and existing transformed values. The intended use here is in the internals of brewscheme and brewtheme to provide a consistent format for scheme files generated by these programs. Additionally, it also facilitates the automation of scheme files with simulated values for different forms of color sight impairment using the same stub name with an additional identifier in the file name for the type of color sight impairment.

brewcolor members

color A private string matrix containing the required data from the database created by brewcolordb.

meta A private string matrix containing the required data from the database created by brewdb and brewextra.

brewcolor methods

brewNameSearch() is a method used to search for colorblind transformed RGB values given the color’s name or meta property. This method searches the palette and meta variables in the color member of the brewcolor class.

brewColorSearch() is a method used to search for colorblind transformed RGB values given an RGB string. This method searches the rgb variable in the color and meta members of the brewcolor class.

getNames() is a method used to retrieve the full list of all values in the palette or meta variables of the color and meta databases.

getPalette(string, real) is a method used to access the RGB values of the palette specified in the first parameter with the number of colors specified in the second parameter. This method is used by brewscheme in place of the levelsof command to make sure the RGB values are retrieved in the correct order.

References

Bostock, M., Ogievetsky, V., & Heer, J. (2011). D3: data driven documents. IEEE Transactions on Visualization & Computer Graphics. 17(12) pp 2301 - 2309. Retrieved from http://vis.stanford.edu/papers/d3

Brewer, C. A. (2002). Color Brewer 2. [Computer Software]. State College, PA: Cynthia Brewer, Mark Harrower, and The Pennsylvania State University

Krzywinski, M. (2015). Color palettes for color blindness. Retrieved on: 22nov2015. Retrieved from: http://mkweb.bcgsc.ca/colorblind/

Lin, S., Fortuna, J., Kulkarni, C., Stone, M., {c 38} Heer, J. (2013). Selecting Semantically-Resonant Colors for Data Visualization. Computer Graphics Forum 32(3) pp. 401-410. Retrieved from http://vis.stanford.edu/files/2013-SemanticColor-EuroVis.pdf

Wickham, H. (2009). ggplot2: Elegant Graphics for Data Analysis. New York City, NY: Springer Science+Business Media LLC.