Colormaps: Difference between revisions
(Created page with "You can create an xml file like this: <ColorMap name="Consistency" space="RGB"> <Point x="-1.000" o="1" r="0.0" g="0.0" b="0.0"/> <Point x="0.000" o="1" r="0.0" g="1.0" b="0.0"/...") |
Andy.bauer (talk | contribs) |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Image:Luts.png|thumb|200px|Figure 1. ParaView's '' '''Choose Preset''' '' dialog after importing 41 IDL LUT's and 50 Matplotlib LUT's.]] | |||
__TOC__ | |||
Back to [[ParaView#GUI_Features|ParaView Wiki Home]] | |||
== Contributed Colormaps == | |||
The following files contain collections of colormaps. To use them download the file and import it using ParaView's '' '''Color Map Editor''' '' dialog. Open the editor, select '' '''Choose Preset''' '' and then '' '''Import''' '' and select the file. | |||
* 41 colormaps from [http://www.ittvis.com/language/en-us/productsservices/idl.aspx IDL] : [[Media:All idl cmaps.xml|all_idl_cmaps.xml]] | |||
* 50 colormaps from [http://matplotlib.sourceforge.net/ Matplotlib] : [[Media:All mpl cmaps.xml|all_mpl_cmaps.xml]] | |||
Refer to figure 1 for example of the new LUT's. | |||
== ParaView's xml colormap file format == | |||
You can create an xml file like this: | You can create an xml file like this: | ||
<source lang=xml> | |||
<ColorMaps> | |||
<ColorMap name="Consistency" space="RGB"> | <ColorMap name="Consistency" space="RGB"> | ||
<Point x="-1.000" o="1" r="0.0" g="0.0" b="0.0"/> | <Point x="-1.000" o="1" r="0.0" g="0.0" b="0.0"/> | ||
Line 6: | Line 22: | ||
<Point x="1.000" o="1" r="1.0" g="0.0" b="0.0"/> | <Point x="1.000" o="1" r="1.0" g="0.0" b="0.0"/> | ||
</ColorMap> | </ColorMap> | ||
</ColorMaps> | |||
</source> | |||
which specifies that values=-1 should be black (rgb=(0,0,0)), values at 0 should be green, and values at 1 should be red. You can then click "Edit color map" -> "Choose preset" -> "Import", select the new xml file, and you will see the colors are interpolated along the new color axis you have defined. | which specifies that values=-1 should be black (rgb=(0,0,0)), values at 0 should be green, and values at 1 should be red. You can then click "Edit color map" -> "Choose preset" -> "Import", select the new xml file, and you will see the colors are interpolated along the new color axis you have defined. | ||
The following Matlab function writes a Matlab named color map to the Paraview xml color map format. The argument to be passed in is the name of the colormap (default is 'jet'). | == Writing a Matlab color map to xml == | ||
The following Matlab function writes a Matlab named [http://www.mathworks.com/access/helpdesk/help/techdoc/ref/colormap.html color map] to the Paraview xml color map format. The argument to be passed in is the name of the colormap (default is 'jet'). | |||
<source lang=matlab> | |||
function [] = paraview_color_space(scheme) | function [] = paraview_color_space(scheme) | ||
if (exist('scheme') ~= 1), scheme='jet'; end | if (exist('scheme') ~= 1), scheme='jet'; end | ||
Line 25: | Line 45: | ||
fclose(fid); | fclose(fid); | ||
end | end | ||
</source> |
Latest revision as of 21:53, 27 April 2017
Back to ParaView Wiki Home
Contributed Colormaps
The following files contain collections of colormaps. To use them download the file and import it using ParaView's Color Map Editor dialog. Open the editor, select Choose Preset and then Import and select the file.
- 41 colormaps from IDL : all_idl_cmaps.xml
- 50 colormaps from Matplotlib : all_mpl_cmaps.xml
Refer to figure 1 for example of the new LUT's.
ParaView's xml colormap file format
You can create an xml file like this:
<source lang=xml> <ColorMaps> <ColorMap name="Consistency" space="RGB"> <Point x="-1.000" o="1" r="0.0" g="0.0" b="0.0"/> <Point x="0.000" o="1" r="0.0" g="1.0" b="0.0"/> <Point x="1.000" o="1" r="1.0" g="0.0" b="0.0"/> </ColorMap> </ColorMaps> </source>
which specifies that values=-1 should be black (rgb=(0,0,0)), values at 0 should be green, and values at 1 should be red. You can then click "Edit color map" -> "Choose preset" -> "Import", select the new xml file, and you will see the colors are interpolated along the new color axis you have defined.
Writing a Matlab color map to xml
The following Matlab function writes a Matlab named color map to the Paraview xml color map format. The argument to be passed in is the name of the colormap (default is 'jet').
<source lang=matlab> function [] = paraview_color_space(scheme)
if (exist('scheme') ~= 1), scheme='jet'; end colors = eval(scheme); N = length(colors); fid = fopen([scheme '.xml'], 'w'); fprintf(fid, '<ColorMap name="%s" space="HSV">\n', scheme); for i=1:N x = [(i-1)/(N-1); colors(i,:)']; fprintf(fid, ' <Point x="%f" o="1" r="%f" g="%f" b="%f"/>\n', x); end fwrite(fid, '</ColorMap>'); fclose(fid);
end </source>