Python Forum
How to plot multiple scatter plots in seaborn - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to plot multiple scatter plots in seaborn (/thread-19775.html)



How to plot multiple scatter plots in seaborn - vikola - Jul-13-2019

Hi Python users,

I'm a beginner and wondering if anyone can help with advice on how to plot multiple scatterplots using a loop

import pandas as pd
import matplotlib as plt
import seaborn as sns, numpy as np
import matplotlib.pyplot as plt
data = pd.read_stata('theta_se_matrix.dta')
sns.pairplot(data, kind="scatter", diag_kind="kde", vars=["theta1", "theta2", "theta3", "theta4", "theta5", "theta6"], hue="method")
plt.show()
I want to plot separate graphs for each category of "method'

Thanks


RE: How to plot multiple scatter plots in seaborn - scidam - Jul-14-2019

Unfortunately, I don't understand the question. line 6 in your code plots a 6x6 grid of axes with probability density estimations on the main diagonal of the grid. hue parameter just makes all graphs colored. If you need to customize pairplot function, you can use PairGrid class .


RE: How to plot multiple scatter plots in seaborn - vikola - Jul-14-2019

The scatter graph is colored based on the hue parameter, but I want separate graphs for each category of the hue parameter.

in my Stata code, what I wanted to graph in Python is implemented as;

forv i=2/7 {
foreach s in theta se {
graph matrix 's'1 's'2 's'3 's'4 's'5 's'6 if method=='i'
}
}

Any help on how to implement in Python will be appreciated