Python Forum
How to plot multiple scatter plots in seaborn
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to plot multiple scatter plots in seaborn
#1
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
Reply
#2
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 .
Reply
#3
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Plot multiple 2D Curves in 3D stc 5 893 Jun-11-2023, 05:48 PM
Last Post: snippsat
  Multiple Plots in Spyder PythonAndMe2023 0 816 Feb-03-2023, 07:00 PM
Last Post: PythonAndMe2023
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,575 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
Shocked plt.scatter() errors asja2010 0 1,412 Oct-13-2022, 08:15 AM
Last Post: asja2010
  How to plot seaborn heatmap on top of a background circle SriRajesh 0 1,368 Jul-09-2022, 04:00 AM
Last Post: SriRajesh
  Installing and Using Seaborn Led_Zeppelin 4 2,470 Jun-07-2022, 09:44 PM
Last Post: snippsat
  Multiple user defined plots with secondary axes using for loop maltp 1 1,393 Apr-30-2022, 10:19 AM
Last Post: maltp
  Subplot - Plotting 4 plots on the same row Menthix 1 1,391 Nov-07-2021, 09:03 PM
Last Post: deanhystad
  How to invert scatter plot axis Mark17 3 2,447 Sep-22-2021, 04:45 PM
Last Post: jefsummers
  Multiple Plotting in Same PLot quest 0 1,777 Apr-18-2021, 10:29 AM
Last Post: quest

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020