[vtkusers] Graph vertex coloring not working
Jeff Baumes
jeff.baumes at kitware.com
Wed Mar 31 10:38:34 EDT 2010
You need to specify the array to color by with
graphLayoutView->SetVertexColorArrayName("color");
The default is to color by vertex degree, which is why there were two
of each color (degree 1 and 2).
Jeff
On Tue, Mar 30, 2010 at 10:30 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>>> I did what you said (using a vtkViewTheme) and it still seems to have
>>> the problem of 2 vertices get colored one color (red) and two another
>>> (green).
>>
>> You are close. You only set 2 table values, so all scalars will be
>> mapped to one or the other. If you add intermediate table values you
>> would be ok.
>>
>> Jeff
>>
>
> I tried using a vtkLookupTable instead:
> http://www.vtk.org/Wiki/VTK/Examples/Graphs/ColorVertices
>
> Both of these:
> http://www.vtk.org/Wiki/VTK/Examples/ColorTransferFunction
> http://www.vtk.org/Wiki/VTK/Examples/ColorLookupTable
>
> can definitely interpolate colors - why would it not work for vertex coloring?
>
> Also, I tried setting 3 low values and 1 high value:
> vertexColors->InsertNextValue(1);
> vertexColors->InsertNextValue(3);
> vertexColors->InsertNextValue(2);
> vertexColors->InsertNextValue(10);
>
> expecting to see 3 of one color and 1 of the other (if they are
> clamping like you said), but I still see 2 blue and 2 red.
>
> Thanks,
>
> David
>
More information about the vtkusers
mailing list