text_plain_output_1.png
import matplotlib.pyplot as plt

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

train_df = pd.read_csv('../input/train.csv')
potential_energy_df = pd.read_csv('../input/potential_energy.csv')
mulliken_charges_df = pd.read_csv('../input/mulliken_charges.csv')
scalar_coupling_contributions_df = pd.read_csv('../input/scalar_coupling_contributions.csv')
magnetic_shielding_tensors_df = pd.read_csv('../input/magnetic_shielding_tensors.csv')
dipole_moments_df = pd.read_csv('../input/dipole_moments.csv')
structure_df = pd.read_csv('../input/structures.csv')
test_df = pd.read_csv('../input/test.csv')

colors = sns.color_palette('cubehelix', 8)
sns.set()
subsample = 100

fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(111, projection='3d')

scatter_colors = sns.color_palette("husl", 85003)

# 3D scatter
ax.scatter(dipole_moments_df['X'][::subsample], dipole_moments_df['Y'][::subsample],
           dipole_moments_df['Z'][::subsample], s=30, alpha=0.5, c=scatter_colors[::subsample])

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('Dipole Moment')

distances = np.asarray([x**2 + y**2 + z**2 for x, y, z in zip(dipole_moments_df['X'],dipole_moments_df['Y'], dipole_moments_df['Z'])])

fig, ax = plt.subplots(1, 2, figsize=(12, 6))
ax = ax.flatten()

# original distribution
sns.distplot(distances, color=colors[0], kde=False, norm_hist=False, ax=ax[0])
ax[0].set_xlabel('distance')

# in log
sns.distplot(np.log(distances + 0.00001), color=colors[0], kde=False, norm_hist=False, ax=ax[1])
ax[1].set_xlabel('log distance')

fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(111, projection='3d')

scatter_colors = sns.color_palette("husl", 29)

# 3D scatter
for i in range(29):
    xx = magnetic_shielding_tensors_df.loc[magnetic_shielding_tensors_df['atom_index']==i, 'XX']
    yy = magnetic_shielding_tensors_df.loc[magnetic_shielding_tensors_df['atom_index']==i, 'YY']
    zz = magnetic_shielding_tensors_df.loc[magnetic_shielding_tensors_df['atom_index']==i, 'ZZ']
    ax.scatter(xx[::subsample*100], yy[::subsample*100], zz[::subsample*100], s=30, alpha=0.5, c=scatter_colors[i])

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('Magnetic shielding tensors')

# potential energy
fig, ax = plt.subplots(2, 1, figsize=(12, 8))
ax = ax.flatten()

sns.distplot(potential_energy_df['potential_energy'], 
             kde=False, color=colors[0], ax=ax[0])

ax[1].plot(np.arange(0, 85003, subsample*10), potential_energy_df['potential_energy'][::subsample*10],  
           c=colors[0], alpha=0.5)
ax[1].set_xlabel('molecular name')
ax[1].set_ylabel('potential energy')
plt.tight_layout()

fig, ax = plt.subplots(6, 5, figsize=(12, 16))
ax = ax.flatten()
for i in range(29):
    sns.distplot(mulliken_charges_df.loc[mulliken_charges_df['atom_index'] == i, 'mulliken_charge'], kde=False, color=colors[2], ax=ax[i])
    ax[i].set_title('atom index ' + str(i))
    ax[i].set_xlabel('')
    ax[i].set_ylabel('')
plt.tight_layout()