Sandman42
Sandman42

Reputation: 75

Matplotlib image not coming up in Visual Studio Code

I've written a sample program for using maplotlib and seaborn:

import matplotlib as plt
import numpy as np
import random
import seaborn as sns
rolls = [random.randrange(1, 7) for i in range(600)]
values, frequencies = np.unique(rolls, return_counts=True)
title = f'Rolling a Six-Sided Die {len(rolls):,} Times'
sns.set_style('whitegrid')
axes = sns.barplot(x=values, y=frequencies, palette='bright')

Everything is calculated correctly (I've omitted print's for brevity), but nothing shows up.

I've tried either under command line, and with vscode.

I'm running windows 7, python 3.7.7 and conda 4.8.3

What am I missing?

Thanks

Upvotes: 1

Views: 215

Answers (1)

Francisco M.
Francisco M.

Reputation: 81

you need to print the graph, you need next lines of code

soportes[:].plot.bar(x='row', y='column')

#soportes[row_init: row_finish].plot.bar(x='variable', y='variable')

plt.ylabel('Soporte') #name axis y

plt.xlabel('Producto') #name axis x

plt.title('Soporte por producto Prior') #name windows

plt.savefig('Graph/Prior_Barra.png', bbox_inches="tight") #save graph

plt.show() # to show graph

delete line axes = sns.barplot(x=values, y=frequencies, palette='bright')

Upvotes: 1

Related Questions