Fill area between lines with different colors

Hi,

Is there a way to plot line that has three dimensions (x, y, z) on two dimensional XY axes and fill the area between this line and some baseline (usually baseline is a constant value line) with color coded by z-values?
In other words the line is represented by three vectors: x, y and z.
Here is the example of it (2nd and 3rd plots): https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/38691/versions/2/screenshot.png

In Matlab it is done via patch() function https://www.mathworks.com/help/matlab/ref/patch.html

Best regards

Seems to me I have found a way to do this.
I’m going to use vtkPlotArea from example.
The idea is to select the points that have the same color via virtual void vtkPlot::SetSelection(vtkIdTypeArray *id) and apply vtkPlot::GetSelectionBrush( ) that should fill selected region with specified color.

The problem that it doesn’t work :upside_down_face:
I write the code:
/* Color object */
vtkNew<vtkNamedColors> colors;
vtkColor3d color3d = colors->GetColor3d("tomato");

/* Create area object */
vtkPlotArea* area = dynamic_cast<vtkPlotArea*>(chart->AddPlot(vtkChart::AREA)); //

/* select 10 first elements */
vtkNew<vtkIdTypeArray> arrSelect;
arrSelect->SetName("Selection");
arrSelect->InsertNextValue(0);
arrSelect->InsertNextValue(1);
arrSelect->InsertNextValue(2);
arrSelect->InsertNextValue(3);
arrSelect->InsertNextValue(4);
arrSelect->InsertNextValue(5);
arrSelect->InsertNextValue(6);
arrSelect->InsertNextValue(7);
arrSelect->InsertNextValue(8);
arrSelect->InsertNextValue(9);
area->SetSelection(arrSelect);

/* Fill selected area with specified color */
area->GetSelectionBrush()->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue(), .6);

When I run the code the hole area is filled with black (i.e. colors didn’t work).


If somebody has idea what do I do incorrect please give me a hint

Best regards