Matplotlib/Seaborn/Visualization | Basics | Priority Flashcards

1
Q

Scatterplot matrix.

A
import matplotlib.pyplot as plt
from mlxtend.plotting import scatterplotmatrix
scatterplotmatrix(df.values, figsize=(12, 10), names=df.columns, alpha=0.5)
plt.tight_layout()
plt.show()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
A
from mlxtend.plotting import heatmap
cm = np.corrcoef(df.values.T)
hm = heatmap(cm, row_names=df.columns, column_names=df.columns)
plt.tight_layout()
plt.show()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Plot on a log scale.

A

plt.xscale(‘log’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Plot a legend, choosing location automatically.

A

plt.legend(loc=’best’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Function: Adjust the padding between and around subplots.

A

plt.tight_layout()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Function: Configure the grid lines.

A

ax.yaxis.grid(True)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Function: Get the current Axes.

A

ax = plt.gca()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Function: Add a vertical line across the Axes.

A

import matplotlib.pyplot as plt; plt.axvline(0.0, color=’k’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly