Difference between revisions of "Colormaps"
From KitwarePublic
Jump to navigationJump to searchLine 1: | Line 1: | ||
== Contributed Colormaps == | == Contributed Colormaps == | ||
− | * IDL colormaps : [[File:All idl cmaps.xml]] | + | * IDL colormaps : [[File:All idl cmaps.xml]] [http://paraview.org/Wiki/images/b/be/All_idl_cmaps.xml] |
== ParaView's xml colormap file format == | == ParaView's xml colormap file format == |
Revision as of 16:56, 3 November 2011
Contributed Colormaps
- IDL colormaps : File:All idl cmaps.xml [1]
ParaView's xml colormap file format
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"/>
<Point x="1.000" o="1" r="1.0" g="0.0" b="0.0"/>
</ColorMap>
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').
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