Modifier and Type | Field and Description |
---|---|
protected Color[] |
colorMap |
protected Color[][] |
colors |
protected double |
displayMax |
protected double |
displayMin
Min and max values to display, which might not be the actual min and max values in the matrix.
|
protected DoubleMatrixReader |
m_matrixReader |
protected int[] |
m_rowKeys
to be able to sort the rows by an arbitrary key
|
protected int |
m_totalColumns |
protected int |
m_totalRows |
protected double |
max |
protected DoubleMatrix<A,B> |
maxtrix |
protected double |
min |
protected Color |
missingColor |
Constructor and Description |
---|
ColorMatrix(DoubleMatrix<A,B> matrix) |
ColorMatrix(DoubleMatrix<A,B> matrix,
Color[] colorMap,
Color missingColor) |
Modifier and Type | Method and Description |
---|---|
ColorMatrix<A,B> |
clone() |
protected int[] |
createRowKeys()
To be able to sort the rows by an arbitrary key.
|
Color |
getColor(int row,
int column) |
Color[] |
getColorMap() |
Color[][] |
getColors() |
int |
getColumnCount() |
B |
getColumnName(int column) |
String[] |
getColumnNames() |
double |
getDisplayMax() |
double |
getDisplayMin() |
DoubleMatrix<A,B> |
getMatrix() |
double |
getMax() |
DoubleMatrix<A,B> |
getMaxtrix() |
double |
getMin() |
Color |
getMissingColor() |
double[] |
getRow(int row) |
double[] |
getRowByName(A rowName) |
int |
getRowCount() |
int |
getRowIndexByName(A rowName) |
Object |
getRowName(int row) |
String[] |
getRowNames() |
protected int |
getTrueRowIndex(int row) |
double |
getValue(int row,
int column) |
void |
mapValuesToColors() |
static <R,C> ColorMatrix<R,C> |
newInstance(DoubleMatrix<R,C> matrix) |
void |
resetRowKeys() |
void |
setColor(int row,
int column,
Color newColor) |
void |
setColorMap(Color[] colorMap) |
void |
setDisplayRange(double min,
double max)
Standardized display range
|
protected void |
setRow(int row,
double[] values)
Changes values in a row, clipping if there are more values than columns.
|
void |
setRowKeys(int[] rowKeys) |
void |
standardize()
Normalizes the elements of a matrix to variance one and mean zero, ignoring missing values todo move this to
matrixstats or something.
|
protected Color[] colorMap
protected Color[][] colors
protected double displayMax
protected double displayMin
protected DoubleMatrixReader m_matrixReader
protected int[] m_rowKeys
protected int m_totalRows
protected int m_totalColumns
protected double max
protected DoubleMatrix<A,B> maxtrix
protected double min
protected Color missingColor
public ColorMatrix(DoubleMatrix<A,B> matrix)
public ColorMatrix(DoubleMatrix<A,B> matrix, Color[] colorMap, Color missingColor)
matrix
- the matrixcolorMap
- the simplest color map is one with just two colors: { minColor, maxColor }missingColor
- values missing from the matrix or non-numeric entries will be displayed using this colorpublic static <R,C> ColorMatrix<R,C> newInstance(DoubleMatrix<R,C> matrix)
public ColorMatrix<A,B> clone()
public Color getColor(int row, int column) throws ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
public Color[] getColorMap()
public Color[][] getColors()
public int getColumnCount()
public B getColumnName(int column) throws ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
public String[] getColumnNames()
public double getDisplayMax()
public double getDisplayMin()
public DoubleMatrix<A,B> getMatrix()
public double getMax()
public DoubleMatrix<A,B> getMaxtrix()
public double getMin()
public Color getMissingColor()
public double[] getRow(int row) throws ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
public double[] getRowByName(A rowName)
public int getRowCount()
public int getRowIndexByName(A rowName)
public Object getRowName(int row) throws ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
public String[] getRowNames()
public double getValue(int row, int column) throws ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
public void mapValuesToColors()
public void resetRowKeys()
public void setColor(int row, int column, Color newColor) throws ArrayIndexOutOfBoundsException
row
- column
- newColor
- ArrayIndexOutOfBoundsException
public void setColorMap(Color[] colorMap) throws IllegalArgumentException
colorMap
- an array of colors which define the midpoints in the color map; this can be one of the constants
defined in the ColorMap class, like ColorMap.REDGREEN_COLORMAP and ColorMap.BLACKBODY_COLORMAPIllegalArgumentException
- if the colorMap array argument contains less than two colors.public void setDisplayRange(double min, double max)
public void setRowKeys(int[] rowKeys)
rowKeys
- public void standardize()
protected int[] createRowKeys()
m_rowKeys
array and initializes it in
ascending order from 0 to m_totalRows
-1, so that by default it matches the physical order of the
columns: [0,1,2,...,m_totalRows-1]protected int getTrueRowIndex(int row)
protected void setRow(int row, double[] values)
row
- row whose values we want to changevalues
- new row valuesCopyright © 2003–2022 UBC Michael Smith Laboratories. All rights reserved.