# Generating line plots for each time step separately

**URL:** https://discourse.paraview.org/t/generating-line-plots-for-each-time-step-separately/7558
**Category:** ParaView Support
**Created:** [July 6, 2021, 2:58pm UTC](https://discourse.paraview.org/t/generating-line-plots-for-each-time-step-separately/7558 "2021-07-06T14:58:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lukas1](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/a698b9/32.png) [@Lukas1](https://discourse.paraview.org/u/Lukas1)
#### Post date: [July 6, 2021, 2:58pm UTC](https://discourse.paraview.org/t/generating-line-plots-for-each-time-step-separately/7558/1 "2021-07-06T14:58:41Z")

</div>

Dear community,

I am currently working on some sort of specialized export.

Basically, I need PlotOverLine at different locations based on the time step. I am planing to provide an array and change the location of PlotOverLine on each time step individually via a loop.

Currently I took a step back and tried to mimic the “WriteAllTimeSteps=1” manually, which is normally a buildin function in SaveData (I am still using Paraview 4.4.0). However, the change of time step from “AnimationScene1” does not apply to “plotOverLine1”. I get the csv files (even the right number), but they all give the same result. So how do I get the change of time step applied to “plotOverLine1”?

Below the code snipped which I use. “vtu\_List” is a list of all VTU files in the particular folder, “Coords” is a collection of coordinates for the line plots and “passArrays1” is a filtered subset from the original input.

# set active source

SetActiveSource(passArrays1)  
AnimationScene1 = GetAnimationScene()

for i in range(len(Coords)):  
AnimationScene1.GoToFirst()  
for j in range(len(vtu\_List)):  
plotOverLine1 = PlotOverLine(Input=passArrays1, Source=‘High Resolution Line Source’)

```
# Properties modified on plotOverLine1
plotOverLine1.Tolerance = 5.0e-16
# Properties modified on plotOverLine1.Source
plotOverLine1.Source.Point1 = Coords[i][0]
plotOverLine1.Source.Point2 = Coords[i][1]
# save data
SaveData(path+'/Export'+str(i+2)+'_'+str(j)+'.csv', proxy=plotOverLine1, Precision=8, UseScientificNotation=1)#, WriteAllTimeSteps=1)

AnimationScene1.GoToNext()

```

Kind regards,

Lukas

---

<div class="post-metadata">

### Author: ![Lukas1](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/a698b9/32.png) [@Lukas1](https://discourse.paraview.org/u/Lukas1)
#### Post date: [July 15, 2021, 7:06am UTC](https://discourse.paraview.org/t/generating-line-plots-for-each-time-step-separately/7558/2 "2021-07-15T07:06:13Z")

</div>

I figured it out by myself. Here the code snipped, which did the trick:

```auto
i=0

SetActiveSource(rTT_)

tsteps = rTT_.TimestepValues

PlotOverLine1 = PlotOverLine(Input=passArrays1, Source='High Resolution Line Source')

Data = Show()

view = GetActiveView()

j=0
i=i+1
for TimeStepNum in range(len(tsteps)):
    view.ViewTime = tsteps[TimeStepNum]
    PlotOverLine1.Source.Point1 = [l1[j],0.0,T]
    PlotOverLine1.Source.Point2 = [l1[j],B,T]
    Render()
    writer = CreateWriter("Export"+str(i)+".%d.csv" %(TimeStepNum), PlotOverLine1)
    #writer.FieldAssociation = "Point Data"
    writer.UpdatePipeline()
    Render()
    del writer
    j=j+1

```

For clarification:  
rTT\_ is the name of my unstructured grid reader and passArrays1 is a filter for the desired quantities I want to write (speeds up the whole process). In variable l1, the coordinate (in x-direction) of the line plot was pre defined for every time step.

I hope this might help someone in the future.

Kind regards,

Lukas
