Density Plot with Pandas#

  • Contributor: Martin Diehl (https://martin-diehl.net)

  • DAMASK version: 3.0.0

  • Prerequisites (data): DADF5 file with 1. Piola-Kirchhoff stress (‘P’) and deformation gradient (‘F’)

[1]:
%matplotlib inline
[2]:
import damask
import pandas as pd
[3]:
# adjust to your situation, file needs to exist
result_file = 'densityplot/20grains16x16x16_tensionX.hdf5'
[4]:
result = damask.Result(result_file)
result = result.view(increments=-1)            # only view last increment
result = result.view(homogenizations=False)    # do not consider homogenization results
[5]:
df = pd.DataFrame({'F_11':result.get('F')[:,0,0],
                   'P_11':result.get('P')[:,0,0]})
_ = df.plot.hexbin(x='F_11',y='P_11',gridsize=20,
                   cmap=damask.Colormap.from_predefined('strain'))
../../_images/documentation_examples_densityplot_5_0.png