How can i draw .txt data written in meshgrid format.

Hi,
How can i draw .txt data written in meshgrid format. in matlab i used to draw it as following
Ux.txt (231.6 KB)
thanks.
a=1:1:72;
b=1:1:71;
[A, B]=meshgrid(a,b);
contourf(A,B,data’,30);

How is your data formatted ? It only contains numbers.

Hello,

I was able to load it in the same way as the link below.

Now you need to modify the Script (RequestInformation) and Script in the Programmable Source Filter.

  • Script (RequestInformation)
from paraview import util
util.SetOutputWholeExtent(self, [0, 140, 0, 141, 0, 0])
  • Script
import numpy as np

path = 'your_data_path/Ux.txt'
a = np.loadtxt(path, encoding='utf-8_sig').flatten()

output.SetDimensions(141, 142, 1)
output.SetOrigin(0.0, 0.0, 0.0)
output.SetSpacing(1, 1, 1)
output.PointData.append(a, 'height')

1 Like