# Display of variable

**URL:** https://discourse.paraview.org/t/display-of-variable/4021
**Category:** ParaView Support
**Tags:** python
**Created:** [April 10, 2020, 8:06am UTC](https://discourse.paraview.org/t/display-of-variable/4021 "2020-04-10T08:06:56Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Samanvith\_A](https://discourse.paraview.org/user_avatar/discourse.paraview.org/samanvith_a/32/2378_2.png) [@Samanvith\_A](https://discourse.paraview.org/u/Samanvith_A)
#### Post date: [April 10, 2020, 8:06am UTC](https://discourse.paraview.org/t/display-of-variable/4021/1 "2020-04-10T08:06:56Z")

</div>

Hello everyone.

I have a set of VTK files which is a 3D cube. I have attached the link to it below. I have loaded into the paraview and have created an animation view of it.

 ![HI_map](https://discourse.paraview.org/uploads/default/original/2X/8/89bb2bb1b3f89a588626db077bbb1e7e881fe567.png)

Now I want to display a variable “i” in the render view itself, as the animation progress. ( The variable ‘i’ has int value)  
Example:  
I have kept the animation frame number to 600. The start time is 0 and the end time is 6.  
So as the animation progresses from 0 to 6, I want to print the variable ‘i’ in the render view  
VTK file: [https://drive.google.com/open?id=1eN79xMyed0Uj9Uyugv5YSskwtzXsquTn](https://drive.google.com/open?id=1eN79xMyed0Uj9Uyugv5YSskwtzXsquTn)

I hope my query is clear.

Thank you in advance

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 10, 2020, 1:48pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/2 "2020-04-10T13:48:09Z")

</div>

You can use the **Annotate Time Filter** to show the current time.

---

<div class="post-metadata">

### Author: ![Samanvith\_A](https://discourse.paraview.org/user_avatar/discourse.paraview.org/samanvith_a/32/2378_2.png) [@Samanvith\_A](https://discourse.paraview.org/u/Samanvith_A)
#### Post date: [April 10, 2020, 5:06pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/3 "2020-04-10T17:06:33Z")

</div>

Thanks for your response.  
That helped me a bit, but it would print the current time, which is not the required result.  
Say for example:  
for i in range (1,5)  
print(i)  
This would print 1 to 4, which is what I want to print.  
Is it possible?

@cory.quammen

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 10, 2020, 5:15pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/4 "2020-04-10T17:15:47Z")

</div>

Is `i` the timestep index here? Or does `i` come from somewhere else?

---

<div class="post-metadata">

### Author: ![Samanvith\_A](https://discourse.paraview.org/user_avatar/discourse.paraview.org/samanvith_a/32/2378_2.png) [@Samanvith\_A](https://discourse.paraview.org/u/Samanvith_A)
#### Post date: [April 10, 2020, 5:22pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/5 "2020-04-10T17:22:47Z")

</div>

'i" isn’t a time step. I want to print it as a separate variable, whose value varies from -x\< i \> +x  
@cory.quammen

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 10, 2020, 5:28pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/6 "2020-04-10T17:28:50Z")

</div>

Use the **Python Annotation** filter with the **Expression** set to

`"".join(map(lambda x: "%d " % x, range(0, 6)))`

---

<div class="post-metadata">

### Author: ![Samanvith\_A](https://discourse.paraview.org/user_avatar/discourse.paraview.org/samanvith_a/32/2378_2.png) [@Samanvith\_A](https://discourse.paraview.org/u/Samanvith_A)
#### Post date: [April 10, 2020, 5:40pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/7 "2020-04-10T17:40:06Z")

</div>

@cory.quammen  
I want the variable to be dynamic. Your expression gives me a static variable where the all the values are printed in the beginning itself.  
is it possible to change it as the animation progress?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 10, 2020, 5:44pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/8 "2020-04-10T17:44:13Z")

</div>

> [@Samanvith\_A](#):
>
> I want the variable to be dynamic. Your expression gives me a static variable where the all the values are printed in the beginning itself.

I’m doing the best I can with the description you have provided up to this point. How do you plan to set the variable “i”? Is it a function of time? Do you want to set it in the GUI. Please be as specific as possible.

---

<div class="post-metadata">

### Author: ![Samanvith\_A](https://discourse.paraview.org/user_avatar/discourse.paraview.org/samanvith_a/32/2378_2.png) [@Samanvith\_A](https://discourse.paraview.org/u/Samanvith_A)
#### Post date: [April 10, 2020, 5:54pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/9 "2020-04-10T17:54:49Z")

</div>

@cory.quammen

I really appreciate your help.

I have 7 VTK files ( have provided the link before), whose animation has to be created. During the animation, I want to display a variable " i " to be displayed in the GUI ( side by the 3D cube). The value of “i” varies from ( 16.095 to 7.221, decreasing order) i.e as the animation progress with the time, the value starting from 16.095 up to 7.221 has to printed.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 10, 2020, 6:05pm UTC](https://discourse.paraview.org/t/display-of-variable/4021/10 "2020-04-10T18:05:16Z")

</div>

Okay. Assuming “i” varies linearly with time, then use a **Python Annotation** filter with **Expression**

`16.095 - ((16.095-7.221)*time_index)/7`.

You may need to tweak the denominator, but this should work.
