Skip to content Skip to sidebar Skip to footer

Matplotlib To Plot A Pairplot?

Yesterday I posted this: Correlation scatter plot using DataFrame matrix? Because my English is not so good on the technical side, it was hard for me to explain what was my problem

Solution 1:

Based on the link in my comment, you can do

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplotas plt

df = pd.DataFrame({'ozone': [1.0, 0.3483416929936026, 0.6985414096486389, -0.6129507522144628],
               'radiation': [0.3483416929936026, 1.0, 0.2940876437245132, -0.12736562398818144],
               'temperature':[0.6985414096486389, 0.2940876437245132, 1.0, -0.49714591092004284],
               'wind': [-0.6129507522144628, -0.12736562398818144, -0.49714591092004284, 1.0]})

g = pd.plotting.scatter_matrix(df, figsize=(10,10), marker = 'o', hist_kwds = {'bins': 10}, s = 60, alpha = 0.8)

plt.show()

enter image description here I'm not sure why you don't want to use Seaborn, but you can do the same thing easily by doing

# Plot using Seaborn
sns.pairplot(df, diag_kws={'bins': 10})

enter image description here

Post a Comment for "Matplotlib To Plot A Pairplot?"