# vtkParallelCoordinatesView coloring lines based on scalar value

**URL:** https://discourse.vtk.org/t/vtkparallelcoordinatesview-coloring-lines-based-on-scalar-value/6531
**Category:** Support
**Created:** [September 2, 2021, 1:56pm UTC](https://discourse.vtk.org/t/vtkparallelcoordinatesview-coloring-lines-based-on-scalar-value/6531 "2021-09-02T13:56:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nicfel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicfel/32/3639_2.png) [@nicfel](https://discourse.vtk.org/u/nicfel)
#### Post date: [September 2, 2021, 1:56pm UTC](https://discourse.vtk.org/t/vtkparallelcoordinatesview-coloring-lines-based-on-scalar-value/6531/1 "2021-09-02T13:56:16Z")

</div>

Hello all,  
based on [this example](https://kitware.github.io/vtk-examples/site/Cxx/InfoVis/ParallelCoordinatesView/) I created a rendering of some data as a parallel coordinates plot using the _vtkParallelCoordinatesView_. In a different plot where I plot a point cloud I was able to set the color for each point individually by setting a lookup table and selecting a color array. I was using a _vtkPlotPoints_ together with a _vtkChartXY_ and a _vtkContextView_ there so the setup there is a little bit different.

I was wondering if there was something similar for _vtkParallelCoordinatesView_ such that I am able to color lines based on some scalar value? [This](https://en.wikipedia.org/wiki/Parallel_coordinates#/media/File:ParCorFisherIris.png) is an example from wikipedia showing what I am trying to achieve.

Also I am a little bit confused why there is two possible ways to setup a parallel coordinates plot:  
[ParallelCoordinatesView](https://kitware.github.io/vtk-examples/site/Cxx/InfoVis/ParallelCoordinatesView/)  
[ParallelCoordinates](https://kitware.github.io/vtk-examples/site/Cxx/Plotting/ParallelCoordinates/)  
They both share base classes (vtkRenderViewBase I believe) but differ in the way you set them up and their API. I decided to go with the first one since that seems to have better support for interacting with the plot which is something that I need.

---

<div class="post-metadata">

### Author: ![nicfel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicfel/32/3639_2.png) [@nicfel](https://discourse.vtk.org/u/nicfel)
#### Post date: [September 7, 2021, 10:40am UTC](https://discourse.vtk.org/t/vtkparallelcoordinatesview-coloring-lines-based-on-scalar-value/6531/2 "2021-09-07T10:40:24Z")

</div>

So I didnt solve the problem but I decided to try switching to the chart implementation ([vtkChartParallelCoordinates](https://vtk.org/doc/nightly/html/classvtkChartParallelCoordinates.html)) for parallel coordinates rendering. The interaction is a bit different there and I don’t understand how to zoom on an axis but the coloring works just like in my points plot. Here is the a code you need to configure that:

```auto
vtkPlotParallelCoordinates* plot = vtkPlotParallelCoordinates::SafeDownCast(chart->GetPlot(0));
plot->SetScalarVisibility(true);
plot->SetLookupTable(VtkUtilities::brewerCategorical6ClassDark());
plot->SelectColorArray("Scalars");

```

Obviously you need to create other things too but that is done just like in the example. You need to add an aditional array (I called it “Scalars”) to your table which I marked as invisible in the plot. Then you have to add the above code and it should work.
