Seaborn Flashcards
How do you plot a scatter graph?
sns.lmplot(x = ‘col name’, y = ‘col name’, data = df1)
How do you remove fitting a regression line to a scatter graph?
sns.lmplot(fit_reg = False)
How do you colour in a scatter graph?
sns.lmplot(hue = ‘col name’)
How do you get a box and whisker plot?
sns.boxplot(data = df1)
How do you get a violin plot?
sns.violinplot(x = ‘col’, y = ‘col’, data =df1)
How do you get a swarmplot?
sns.swarmplot(x = ‘col’, y = ‘col’, data =df1)
How do you get a scatter plot?
sns.scatterplot()
How do you get a list into a scatter rather than a df?
sns.scatterplot(x = listname, y = listname)
vs
sns.scatterplot(x = ‘col name’, y = ‘col name’, data = df)
Do you need a y value for a count plot?
No
What are the hues in seaborn code names?
Blue = b Green = g Red = r Cyan = c Purple = m Yellow = y Black = k White = w
How do you change the order in a legend?
hue_order = []
What are the benefits of relplot over scatter plot?
You can show subplots
How can you show subplots?
relplot
How do you get a scatter in a relplot?
sns.replot(x = ‘x’, y = ‘y’, data = df, kind = ‘scatter’)
How do you show subplots horiztonally?
sns.replot(x = ‘x’, y = ‘y’, data = df, kind = ‘scatter’, rows = ‘variable’)
How do you show subplots vertically?
sns.replot(x = ‘x’, y = ‘y’, data = df, kind = ‘scatter’, col = ‘variable’)
How do you show subplots both vertically and horiztonally?
sns.replot(x = ‘x’, y = ‘y’, data = df, kind = ‘scatter’, col = ‘variable’, row = ‘variable’)
How do you limit how many subplots are show in columns at one time?
sns.replot(x = ‘x’, y = ‘y’, data = df, kind = ‘scatter’, col = ‘variable’, col_wrap = 2)
How do you specify the order of subplots?
sns.replot(x = ‘x’, y = ‘y’, data = df, kind = ‘scatter’, col = ‘variable’, col_wrap = 2, col_order = [])
Hue only takes colour inputs?
False - you can pass it a categorical variable to colour by type
How do you change the marker for categorical variables?
style = ‘categorical variable’
how do you get a line plot
sns.relplot(x = , y = , data = , kind = ‘line’)
What does a line chart by default show?
confidence interval?
How do you change confidence interval to standard deviation?
sns.relplot(x = , y =, data =, kind = ‘line’, ci = ‘sd’)
What should you use for categorical data?
sns.catplot(x = , y = , data = , kind = ‘count’ or ‘bar’)
How do you set what order categories come in
order = []
How do you turn off confidence intervals
ci = None
How do you elimanate outliers from boxplots?
sym = “”
How do you change lengths of whiskers in a boxplot?
whis = [bottom percentile, top percentile] whis = 2.0 (2 times the IQR)
How do you generate a boxplot?
sns. boxplot()
sns. catplot(kind = ‘box’)
What is the difference between a point plot and a line plot?
Point plot has one categorical variable, line plot has 2 quantitative variables
How do you get a point plot?
kind = ‘point’