Which is which?

Report a typo

Below you have several examples of code and three heatmaps corresponding to them. Match the number of the code snippet to the heatmap it outputs. The name of your dataset is cars.corr(). Note that one of the snippets is incorrect!

Code 1:

plt.imshow(cars.corr(), cmap='Blues', interpolation=None)
plt.colorbar()
plt.gcf().set_size_inches(6, 6)

plt.xticks(range(len(cars.corr().columns)), cars.corr().columns, rotation=90)
plt.yticks(range(len(cars.corr().columns)), cars.corr().columns)

plt.title('Cars \n')

Code 2:

plt.imshow(cars.corr(), cmap='Blues')
plt.colorbar(orientation='horizontal')
plt.gcf().set_size_inches(7, 7)

labels = cars.corr().values
for a in range(labels.shape[0]):
    for b in range(labels.shape[1]):
        plt.text(a, b, '{:.2f}'.format(labels[b, a]), ha='center', va='center', color='black')
        
plt.title('Cars \n')

Code 3:

plt.imshow(X=cars.corr(), cmap='Blues')
plt.colorbar()

plt.xticks(range(len(cars.corr().columns)), cars.corr().columns, rotation=45)
plt.yticks(range(len(cars.corr().columns)), cars.corr().columns)

plt.title('Cars \n')

Code 4:

plt.imshow(Y=cars.corr(), cmap='Blues')
plt.colorbar()

plt.xticks(range(len(cars.corr().values)), cars.corr().columns, rotation=45)
plt.yticks(range(len(cars.corr().columns)), cars.corr().columns)

plt.title('Cars \n')

Heatmap A:

Match code to heatmap: horizontal color bar

Heatmap B:

Match code to heatmap: rotate xticks by 45 degrees

Heatmap C:

Match code to heatmap: rotate xticks by 90 degrees

Match the items from left and right columns
Code 1
Code 2
Code 3
Code 4
Heatmap B
incorrect code
Heatmap A
Heatmap C
___

Create a free account to access the full topic