# Data array multi-component labelling

**URL:** https://discourse.paraview.org/t/data-array-multi-component-labelling/8006
**Category:** ParaView Support
**Created:** [September 16, 2021, 1:42pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006 "2021-09-16T13:42:18Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Jairo\_Useche](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/c57346/32.png) [@Jairo\_Useche](https://discourse.paraview.org/u/Jairo_Useche)
#### Post date: [September 16, 2021, 1:42pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/1 "2021-09-16T13:42:18Z")

</div>

My problem is in the Paraview GUI:

Any vector components can be colored by Magnitude, or by components X, Y, Z. However, Is there a way to enforce this labelling to Ux, Uy, Uz (for example), instead of the spatial-centric notation X, Y,Z? (Similary with tensor components: Magnitude,XX, YY, ZZ, etc…)

Thanks in advance,

Jack

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 16, 2021, 1:45pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/2 "2021-09-16T13:45:03Z")

</div>

This can be done by setting the component name on the vtk data itself.  
You could create a simple programmable filter that would rename the component.

---

<div class="post-metadata">

### Author: ![fredrik](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fredrik/32/5351_2.png) [@fredrik](https://discourse.paraview.org/u/fredrik)
#### Post date: [January 10, 2022, 4:39pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/3 "2022-01-10T16:39:41Z")

</div>

> [@mwestphal](#):
>
> This can be done by setting the component name on the vtk data itself.

Do you mean that the component names of vectors/tensors can be set in a VTK file directly? Any pointers to the format specification in that case?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 10, 2022, 4:41pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/4 "2022-01-10T16:41:49Z")

</div>

No I mean programmatically, although that is doable on the file format itself:

[https://kitware.github.io/vtk-examples/site/VTKFileFormats/](https://kitware.github.io/vtk-examples/site/VTKFileFormats/)

---

<div class="post-metadata">

### Author: ![fredrik](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fredrik/32/5351_2.png) [@fredrik](https://discourse.paraview.org/u/fredrik)
#### Post date: [January 10, 2022, 4:56pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/5 "2022-01-10T16:56:58Z")

</div>

Thanks for the link, although I didn’t find anything about label names there. To clarify what I want: I want to put the label names (`Ux`, `Uy`, `Uz`) in the VTK file itself, is that possible?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 11, 2022, 8:27am UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/6 "2022-01-11T08:27:26Z")

</div>

I’m afraid this is not supported by .vtk files.

---

<div class="post-metadata">

### Author: ![fredrik](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fredrik/32/5351_2.png) [@fredrik](https://discourse.paraview.org/u/fredrik)
#### Post date: [January 11, 2022, 10:07am UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/7 "2022-01-11T10:07:01Z")

</div>

I see, thanks. Slightly tangential is there any interest in annotating 2nd order non-symmetric tensors with `XX`, `YY`, …, just like symmetric tensors? I could not find any discussion about this.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 11, 2022, 10:46am UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/8 "2022-01-11T10:46:50Z")

</div>

no idea what you mean, sounds unrelated to the discussion at hand. please open your own topic if needed.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 12, 2022, 2:05pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/9 "2022-01-12T14:05:41Z")

</div>

To precise my thinking, this is not supported by .vtk file but very well supported by many other formats, like .vtu/vtp files.

---

<div class="post-metadata">

### Author: ![fredrik](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fredrik/32/5351_2.png) [@fredrik](https://discourse.paraview.org/u/fredrik)
#### Post date: [January 12, 2022, 2:14pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/10 "2022-01-12T14:14:42Z")

</div>

I see. I was using VTK file as a collective term – I am mostly interested in `.vtu`, so maybe that could work then?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 12, 2022, 2:38pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/11 "2022-01-12T14:38:09Z")

</div>

Actually supported by both .vtk and .vtu/vtp:  
[cname.vtu](https://discourse.paraview.org/uploads/short-url/vLzYB3gohi6YfU3lZCdDPROQnhs.vtu) (2.4 KB)  
[cname.vtk](https://discourse.paraview.org/uploads/short-url/3L629fcFIslMyiOsG0nWCOSzfbe.vtk) (528 Bytes)  
[cname.vtp](https://discourse.paraview.org/uploads/short-url/mMkvfuCNOgTCNub1DLZxyMBzQhr.vtp) (3.4 KB)

vtk:

```auto
[glow@arch ~/tmp]$ cat cname.vtk 
# vtk DataFile Version 5.1
vtk output
ASCII
DATASET POLYDATA
POINTS 1 float
0 0 0 
METADATA
INFORMATION 2
NAME L2_NORM_RANGE LOCATION vtkDataArray
DATA 2 0 0 
NAME L2_NORM_FINITE_RANGE LOCATION vtkDataArray
DATA 2 0 0 

VERTICES 2 1
OFFSETS vtktypeint64
0 1 
CONNECTIVITY vtktypeint64
0 
POINT_DATA 1
FIELD FieldData 1
Vals 3 1 double
17 13 7 
METADATA
COMPONENT_NAMES

name

INFORMATION 2
NAME L2_NORM_RANGE LOCATION vtkDataArray
DATA 2 22.5167 22.5167 
NAME L2_NORM_FINITE_RANGE LOCATION vtkDataArray
DATA 2 22.5167 22.5167 

```

vtp/vtu:

```auto
[glow@arch ~/tmp]$ cat cname.vtu 
<VTKFile type="UnstructuredGrid" version="1.0" byte_order="LittleEndian" header_type="UInt64">
  <UnstructuredGrid>
    <Piece NumberOfPoints="1" NumberOfCells="1" >
      <PointData>
        <DataArray type="Float64" Name="Vals" NumberOfComponents="3" ComponentName1="name" format="appended" RangeMin="22.516660498" RangeMax="22.516660498" offset="0" >
          <InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
            <Value index="0">

```

---

<div class="post-metadata">

### Author: ![fredrik](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fredrik/32/5351_2.png) [@fredrik](https://discourse.paraview.org/u/fredrik)
#### Post date: [January 12, 2022, 5:10pm UTC](https://discourse.paraview.org/t/data-array-multi-component-labelling/8006/12 "2022-01-12T17:10:45Z")

</div>

Perfect, just what I was looking for.
