How come import matplotlib.pyplot as plt is not working. This is the code for python import matplotlib.pyplot as plt import numpy as np import random import seaborn as sns
How come import matplotlib.pyplot as plt is not working. This is the code for python
import matplotlib.pyplot 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')
axes.set_title(title)
I am providing you with the running code and output below.
The problem which I think is not in your code it's in the platform or IDE in which you are running the code as below you can see I have pasted the same code that you have written and it is working fine for me. So, I suggest if you are working on Data Visualization then instead of using any other IDE you can use anaconda.
I am also running it on anaconda only and haven't faced any problems.
Links to download Anaconda:
https://www.anaconda.com/products/distribution
The process of downloading, installing, and running anaconda is very simple , and below are the steps
Step by step
Solved in 3 steps with 1 images