Plotting data with Paraview
Boovysa, Milano, 2020.

This page is in the Junk directory! Make sure to check some better material on the MAIN PAGE!

That's a very trivial page, but I wish I knew this trick before. Do you ever need to plot 3D data fields, extract stuff, do contours etc?
ParaView is a great option for that. And the best thing is: you don't need to use VTK!

Indeed, the simplest way is producing a CSV file containing a bunch of points and the fields that you wish to plot at these points. We'll consider here two options:
  1. Structured data;
  2. Unstructured data.

Structured data

The simplest option is using a set of equally spaced points, in 3 dimensions. Write them in a CSV file with the following syntax (in the example, the first line is made by labels, then you have x,y,z, coordinates and then the data fields that you need):


Then you do the following:
  1. Open the CSV file with ParaView;
  2. Go to filters and select Table to Structured Grid;
  3. Select for X,Y,Z the relevant columns, sorted by label;
  4. Fill the "Whole Extent" fields: if your x,y,z vectors will be 100 elements long, say for the Whole Extent "0" to "99". Click Apply;
  5. Now you need to plot the result (it may not plot automatically): split the screen with the small icon at the top right, create a Render view and then enable the "eye" in the TableToStructuredGrid object, in the left menu.
This strategy is pretty fast and you can load 1GB of data in a matter of a couple minutes (as of 2020, on an average laptop). Check out an example result here, of a contour from a data field:

Unstructured data

It is possible to do similar operations using non-structured meshes, aka a bunch of kind of random points in space. To do that, again you can feed the points in CSV format and then you ask ParaView to run a 3D Delaunay triangulation algorithm. This will take a bit of time if the dataset is very large and you need to create many points.

You can click here to download an example file.

The operations are:
  1. Open the CSV file with ParaView, and click Apply.
  2. Go to filters and select (check under "alphabetical order") TableToPoints. Set the X,Y,Z point coordinates to the proper columns. Then click Apply.
  3. Finally, go to filters again and run Delaunay3D. Click Apply.
  4. Enjoy the dataset.
Here's a plot for the field in the example.

-Stefano       -> BACK TO THE HOMEPAGE <-