title: VTK to Matplotlib using Numpy
body: <p>I want to extract some data (e.g. scalars) from a <strong>VTK</strong> file  along with their coordinates on the grid then process it in <strong>Matplotlib</strong>. The problem is I dont know how to grab the point/cell data from the VTK file (by giving the name of the scalar, for instance) and load them into a <strong>numpy</strong> array using <strong>vtk_to_numpy</strong></p>
  
  <p>My code should look like:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  from scipy.interpolate import griddata
  import numpy as np
  from vtk import *
  from vtk.util.numpy_support import vtk_to_numpy
  
  # load input data
  reader = vtk.vtkXMLUnstructuredGridReader()
  reader.SetFileName("my_input_data.vtk")
  reader.Update()
  
  (...missing steps)
  
  # VTK to Numpy
  my_numpy_array = vtk_to_numpy(...arguments ?)
  
  #Numpy to Matplotlib (after converting my_numpy_array to x,y and z)
  CS = plt.contour(x,y,z,NbLevels)
  ...
  </code></pre>
  
  <p>PS:I know that <strong>Paraview</strong> could do the task, but I am trying post process some data without having to open Paraview. Any help is appreciated</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>I found this <a href="http://tcltk.co.kr/files/simplescript.pdf" rel="noreferrer">pdf tutorial</a> to be very useful to learn the basics of handling VTK files</p>