Seaborn Flashcards
(81 cards)
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’)