Wednesday, July 19, 2017

Quick way to represent information graphically using Python

When you have some information example histogram then here is a small example you can refer to:

import random
import numpy as np
import matplotlib.pyplot as plt

x = []
for i in range(1,101):
    x.append(random.randrange(1,101))

h, b = np.histogram(x, bins = 100, range = [0,100])
b = np.delete(b, 0)
plt.show(plt.plot(b,h))



2 comments:

  1. Very helpful article....I think we should make use of this wonderful approach quite often. After all, it makes complex data easy to understand and eye catchy too.

    ReplyDelete
  2. @Sumant ....Can you please add some explanation on every line as to what is the meaning of some arguments ....e.g h, b = np.histogram(x, bins = 100, range = [0,100]), the usage of 'bin' is not so clear, although it works. Also please leave links for the documentation that one can follow.

    ReplyDelete

PROFILE

My photo
India
Design Engineer ( IFM Engineering Private Limited )

Followers