Re: [Paraview] Categorical data in scalar bar

2012-12-31 Thread David Thompson
Hi Tim,

 We have a dataset that ranges from 0 to 7 and represents categorical data. Is 
 it possible through a python script to explicitly set the tick labels on a 
 scalar bar so I can manually map them to strings? For instance:
 
 {0.0 - None, 1.0 - I, 2.0 - J,...} 

In version 3.98 of Paraview, you can do the following at the Python shell in 
ParaView:

# Unfortunately, there is not an easy way to access the Brewer color presets 
from Python;
# Here is one of the categorical schemes:
nanColor=[0.7019607843137254, 0.7019607843137254, 0.7019607843137254]
rgbPoints=[0, 0.4,0.7607843137254902, 0.6470588235294118, \
   1, 0.9882352941176471, 0.5529411764705883, 0.3843137254901961, \
   2, 0.5529411764705883, 0.6274509803921569, 0.796078431372549, \
   3, 0.9058823529411765, 0.5411764705882353, 0.7647058823529411, \
   4, 0.6509803921568628, 0.8470588235294118, 0.32941176470588235, \
   5, 1.0,0.8509803921568627, 0.1843137254901961, \
   6, 0.8980392156862745, 0.7686274509803922, 0.5803921568627451, \
   7, 0.7019607843137254, 0.7019607843137254, 0.7019607843137254]
# Create a vector of strings holding scalar values and their annotations:
annotations = ['0', 'None', '1', 'I', '2', 'J', '3', 'K', '4', 'L', '5', 'M', 
'6', 'N', '7', 'P']
# Create a categorical lookup table
lkup = CreateLookupTable(\
  RGBPoints=rgbPoints, NanColor=nanColor, IndexedLookup=1, 
Annotations=annotations, ColorSpace=HSV)
# Color by the new lookup table:
SetDisplayProperties(LookupTable = lkup)
SetDisplayProperties(ColorAttributeType = CELL_DATA) # or POINT_DATA
SetDisplayProperties(ColorArrayName = YourCategoricalArray)
Render()


David

___
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


[Paraview] Categorical data in scalar bar

2012-12-28 Thread Tim Gallagher
Hi,

We have a dataset that ranges from 0 to 7 and represents categorical data. Is 
it possible through a python script to explicitly set the tick labels on a 
scalar bar so I can manually map them to strings? For instance:

{0.0 - None, 1.0 - I, 2.0 - J,...} 

Thanks,

Tim
___
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