This package contains functions that return color maps. A color map is a Real[:,3] array where every row represents a color. Currently the following color maps are returned from the respective function:
Extends from Modelica.Icons.Package (Icon for standard packages).
Name | Description |
---|---|
jet | Returns the "jet" color map |
hot | Returns the "hot" color map |
gray | Returns the "gray" color map |
spring | Returns the "spring" color map |
summer | Returns the "summer" color map |
autumn | Returns the "autumn" color map |
winter | Returns the "winter" color map |
ColorMaps.jet(); ColorMaps.jet(n_colors=64);
This function returns the color map "jet." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "jet" color map:
Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).
Type | Name | Default | Description |
---|---|---|---|
Integer | n_colors | 64 | Number of colors in the color map |
Type | Name | Description |
---|---|---|
Real | colorMap[n_colors, 3] | Color map to map a scalar to a color |
function jet "Returns the \"jet\" color map" extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap; protected Real a=ceil(n_colors/4); Real d=1/a; Real v1[:]=if d >= 0.5 then {1} else if d >= 0.25 then 1-d:d:1 else 0.5+d:d:1; Real v2[:]=0+d:d:1; Real v3[:]=1-d:-d:0; Real v4[:]=1-d:-d:0.5; Real cm[integer(a)*4,3]; algorithm cm:=255*[zeros(size(v1,1)),zeros(size(v1,1)), v1; zeros(size(v2,1)), v2, fill(1., size(v2,1)); v2, fill(1, size(v2,1)), v3; fill(1, size(v3,1)),v3, fill(0.,size(v3,1)); v4, fill(0,size(v4,1)),fill(0.,size(v4,1))]; colorMap:=cm[1:n_colors,:];end jet;
ColorMaps.hot(); ColorMaps.hot(n_colors=64);
This function returns the color map "hot." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "hot" color map:
Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).
Type | Name | Default | Description |
---|---|---|---|
Integer | n_colors | 64 | Number of colors in the color map |
Type | Name | Description |
---|---|---|
Real | colorMap[n_colors, 3] | Color map to map a scalar to a color |
function hot "Returns the \"hot\" color map" extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap; protected Real a=ceil(n_colors/3); Real d=1/a; Real v1[:]=0+d:d:1; Real cm[integer(a)*3,3]; algorithm cm := 255*[v1, zeros(size(v1, 1)),zeros(size(v1, 1)); fill(1., size(v1, 1)), v1,zeros(size(v1, 1)); fill(1., size(v1, 1)),fill(1., size(v1, 1)),v1]; colorMap:=cm[1:n_colors,:];end hot;
ColorMaps.gray(); ColorMaps.gray(n_colors=64);
This function returns the color map "gray." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "gray" color map:
Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).
Type | Name | Default | Description |
---|---|---|---|
Integer | n_colors | 64 | Number of colors in the color map |
Type | Name | Description |
---|---|---|
Real | colorMap[n_colors, 3] | Color map to map a scalar to a color |
function gray "Returns the \"gray\" color map" extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap; algorithm if n_colors > 1 then colorMap := 255*[linspace(0,1.,n_colors),linspace(0,1.,n_colors),linspace(0,1.,n_colors)]; else colorMap:=[0,0,0]; end if;end gray;
ColorMaps.spring(); ColorMaps.spring(n_colors=64);
This function returns the color map "spring." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "spring" color map:
Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).
Type | Name | Default | Description |
---|---|---|---|
Integer | n_colors | 64 | Number of colors in the color map |
Type | Name | Description |
---|---|---|
Real | colorMap[n_colors, 3] | Color map to map a scalar to a color |
function spring "Returns the \"spring\" color map" extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap; algorithm if n_colors > 1 then colorMap := 255*[fill(1,n_colors),linspace(0,1.,n_colors),linspace(1,0,n_colors)]; else colorMap:=255*[1,0,1]; end if;end spring;
ColorMaps.summer(); ColorMaps.summer(n_colors=64);
This function returns the color map "summer." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "summer" color map:
Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).
Type | Name | Default | Description |
---|---|---|---|
Integer | n_colors | 64 | Number of colors in the color map |
Type | Name | Description |
---|---|---|
Real | colorMap[n_colors, 3] | Color map to map a scalar to a color |
function summer "Returns the \"summer\" color map" extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap; algorithm if n_colors > 1 then colorMap := 255*[linspace(0,1.,n_colors),linspace(0.5,1.,n_colors),fill(0.4,n_colors)]; else colorMap:=255*[0,0.5,0.4]; end if;end summer;
ColorMaps.autumn(); ColorMaps.autumn(n_colors=64);
This function returns the color map "autumn." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "autumn" color map:
Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).
Type | Name | Default | Description |
---|---|---|---|
Integer | n_colors | 64 | Number of colors in the color map |
Type | Name | Description |
---|---|---|
Real | colorMap[n_colors, 3] | Color map to map a scalar to a color |
function autumn "Returns the \"autumn\" color map" extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap; algorithm if n_colors > 1 then colorMap := 255*[fill(1,n_colors),linspace(0,1.,n_colors),zeros(n_colors)]; else colorMap:=255*[1,0,0]; end if;end autumn;
ColorMaps.winter(); ColorMaps.winter(n_colors=64);
This function returns the color map "winter." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "winter" color map:
Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).
Type | Name | Default | Description |
---|---|---|---|
Integer | n_colors | 64 | Number of colors in the color map |
Type | Name | Description |
---|---|---|
Real | colorMap[n_colors, 3] | Color map to map a scalar to a color |
function winter "Returns the \"winter\" color map" extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap; algorithm if n_colors > 1 then colorMap := 255*[zeros(n_colors),linspace(0,1,n_colors),linspace(1,0.5,n_colors)]; else colorMap:=[0,0,255]; end if;end winter;