Data Visual by python matplotlib

in #python6 years ago

1,Line Plot
import matplotlib.pyplot as plt

x=[1,3,5,7,8,7,6,5,2,4] # that two are data
y=[1,2,3,4,5,6,7,8,9,10]

plt.plot(y,x,color='orange',label='line-plot') # this function is drawing the line
plt.show()
2.jpg

2,bar chart
import matplotlib.pyplot as plt

x=[1,3,5,7,8,7,6,5,2,4]
y=[1,2,3,4,5,6,7,8,9,10]

plt.bar(y,x) # draw the bar
plt.show()
3.jpg

3,Histogram Plot

import numpy as np # for making random number
import matplotlib.pyplot as plt

hist=np.random.randn(100)
plt.hist(hist)
plt.show()
4.jpg

4,box plot

import numpy as np
import matplotlib.pyplot as plt
x=[1,3,5,7,8,7,6,5,2,4]
y=[1,2,3,4,5,6,7,8,9,10]
hist=np.random.randn(100)
plt.boxplot([y,x,hist])
plt.show()
5.jpg

5scatter
import matplotlib.pyplot as plt
x=[1,3,5,7,8,7,6,5,2,4]
y=[1,2,3,4,5,6,7,8,9,10]

plt.scatter(y,x)
plt.show()
6.jpg

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.032
BTC 61830.32
ETH 2914.09
USDT 1.00
SBD 3.62