[Paraview] matching matlab and paraview colorspaces
Berk Geveci
berk.geveci at kitware.com
Mon Sep 14 08:55:33 EDT 2009
This would be a good addition to the ParaView Wiki? Jay, would you
mind adding it there? If you don't want to do that, would you mind if
I added it? Thanks.
-berk
On Tue, Sep 8, 2009 at 6:43 PM, Jay Oswald <jjo.lists at gmail.com> wrote:
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
More information about the ParaView
mailing list