Plotting 2D contours using .txt or .dat file

I have a sample file having 3 columns named “Distance”, “U_COMP” and “U_Exact”. I want to plot a 2D contour plot using this .txt file. Let us consider Distance as “X”, U_COMP as “Y” and U_exact as “Z”. Other answers for plotting 2D contours are with help of CSV files but due to loss in precision in CSV files, I cant store my data in CSV files. Therefore I need to know how to use .txt file for plotting 2D contours in Paraview. I am currently using Paraview 5.10.0-RC2
Wave erf grid t = 0.003.txt (183.4 KB)

txt and csv will have the same issue.

Isn’t there any way a text file could be used for contour plotting in ParaView?

Well, VTK XML format can be saved as ASCII text file, but I’m not sure to understand why do you need text file here.

All my solution files have been written in .txt format. Moreover, converting every text file to a CSV is a very tedious task. Furthermore, I could see a loss of 1-2 decimal places after converting the text file to a CSV file. It would be very kind to suggest some way to plot .txt files in a contour format.

You still do not make much sense, do you want to read or write data with ParaView ?

I want to read data from the .txt file and plot 2D contours using that file in Paraview.

You file seems to contains only “DISTANCE”, “U_COMP”,“U_EXACT”, how do you define contours with that ?

Actually, this is not the exact file that I want to plot. I just want to know the methodology of reading .txt files and plotting contours. Just for an example, we can consider DISTANCE as X, U_COMP as Y, and U_Exact as Z. Taking Z as function of X and Y. If there is any other format that needs to be followed while plotting contours, kindly suggest.

is your issue similar to these ones ? Please take a look at the proposed answers

1 Like