[Paraview] matching matlab and paraview colorspaces
Jay Oswald
jjo.lists at gmail.com
Tue Sep 8 18:43:59 EDT 2009
Just in case anyone else wants to do this... particularly if you wish to
compare the results of a matlab simulation to some data plotted in Paraview.
The matlab code below will write a xml file that can be imported into
Paraview. You can either call it with no arguments (this will give the
default jet matlab colorspace) or you can call it with the name of another
colorspace. Now we can all use the "pink" colorspace for our Paraview
plotting ;-)
function [] = paraview_color_space(scheme, N)
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090908/b314b0f5/attachment.htm>
More information about the ParaView
mailing list