# Plotting time series scalars on a single mesh

**URL:** https://discourse.vtk.org/t/plotting-time-series-scalars-on-a-single-mesh/10091
**Category:** Support
**Created:** [December 6, 2022, 1:55pm UTC](https://discourse.vtk.org/t/plotting-time-series-scalars-on-a-single-mesh/10091 "2022-12-06T13:55:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Reshma\_R\_S](https://discourse.vtk.org/user_avatar/discourse.vtk.org/reshma_r_s/32/6187_2.png) [@Reshma\_R\_S](https://discourse.vtk.org/u/Reshma_R_S)
#### Post date: [December 6, 2022, 1:55pm UTC](https://discourse.vtk.org/t/plotting-time-series-scalars-on-a-single-mesh/10091/1 "2022-12-06T13:55:50Z")

</div>

I have a single surface (say, a sphere). For the sphere, I would like to store the scalar named temperature which varies over time. I have data from 1000 time points. Here, I don’t wish to store all the scalar arrays (from 1000 time points) as separate scalar array names. How can I store all the 1000 scalar arrays under one name and switch between them?  
The following line is not suitable me:

```auto
mapper.GetInput().GetPointData().SetActiveScalars("temperature1")
mapper.GetInput().GetPointData().SetActiveScalars("temperature2")
mapper.GetInput().GetPointData().SetActiveScalars("temperature3")
...
mapper.GetInput().GetPointData().SetActiveScalars("temperature1000")

```

Is there a better way?

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [December 6, 2022, 3:43pm UTC](https://discourse.vtk.org/t/plotting-time-series-scalars-on-a-single-mesh/10091/2 "2022-12-06T15:43:55Z")

</div>

Elements in a VTK array are tuples that can have any number of components. So you could store your temperatures as individual components in a tuple.

See the chapter about Data Arrays in VTK Users guide.

---

<div class="post-metadata">

### Author: ![Reshma\_R\_S](https://discourse.vtk.org/user_avatar/discourse.vtk.org/reshma_r_s/32/6187_2.png) [@Reshma\_R\_S](https://discourse.vtk.org/u/Reshma_R_S)
#### Post date: [December 7, 2022, 9:14am UTC](https://discourse.vtk.org/t/plotting-time-series-scalars-on-a-single-mesh/10091/3 "2022-12-07T09:14:34Z")

</div>

Thanks Dan for the reply!  
So I will have to declare that there are 1000 components, and every tuple will have length 1000? That means data for a particlar timestep(1000 Double values) should be inserted into multiple tuples?  
Should I be using the function `SetVectorComponent(int)` to switch between the temporal visualizations? Am I correct? Sorry if I misunderstood you, please correct me if I am wrong.

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [December 9, 2022, 2:36pm UTC](https://discourse.vtk.org/t/plotting-time-series-scalars-on-a-single-mesh/10091/4 "2022-12-09T14:36:48Z")

</div>

It is not clear to me why you want to store all time steps in one dataset. You could switch between time steps to visualize them, you don’t really need to store them together unless you want to process them together somehow.

See  
[https://www.kitware.com/streaming-in-vtk-time/](https://www.kitware.com/streaming-in-vtk-time/)

on how to update a pipeline to a certain time step.
