Hello,
The following setup works for me (C++):
(...)
size_t tableSize = 32; //32 colors, you may want to increase this to a larger number of shades.
double min = 0.0; //0K min temperature
double max = 400.0; //400K max temperature
//create a color interpolator object
vtkSmartPointer<vtkColorTransferFunction> ctf =
vtkSmartPointer<vtkColorTransferFunction>::New();
ctf->SetColorSpaceToRGB();
double delta = max - min;
ctf->AddRGBPoint(min , 0.000, 0.000, 1.000);
ctf->AddRGBPoint(min + delta * 0.25, 0.000, 1.000, 1.000);
ctf->AddRGBPoint(min + delta * 0.50, 0.000, 1.000, 0.000);
ctf->AddRGBPoint(min + delta * 0.75, 1.000, 1.000, 0.000);
ctf->AddRGBPoint(max , 1.000, 0.000, 0.000);
return ctf;
//create the color table object
vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();
lut->SetTableRange(min, max);
lut->SetNumberOfTableValues(tableSize);
for(size_t i = 0; i < tableSize; ++i)
{
double *rgb;
rgb = ctf->GetColor(static_cast<double>(i)/tableSize);
lut->SetTableValue(i, rgb[0], rgb[1], rgb[2]);
}
lut->SetRampToLinear();
lut->Build();
// Create a visualization parameters object
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(r->GetOutputPort());
mapper->SetLookupTable(lut);
mapper->SetScalarModeToUseCellData();
mapper->SetColorModeToMapScalars();
mapper->SelectColorArray("Radiance"); //<-- are you sure the temperature field is called "Radiance"?
mapper->SetScalarRange(min, max);
(...)
This shouldn’t be difficult to port to Python/Javascript since the API is much like the same.
I hope this helps,
PC