简体   繁体   中英

Splitting with comma

I have meaningless numbers like 93283274658402812765.I want to do it like '9','3','2'... and plot it using matplotlib.

So far ;

import matplotlib.pyplot as plt

test= int(bin(93283274658402812765)[2:])
test = [str(d) for d in str(test)]
plt.axis([0, number, 0, 10])
plt.plot(test)
plt.show()

I get sharp transition points it should be a linear rise/fall rectangular histogram. What could be the convenient approach ?

here, this will give you a histogram

import matplotlib.pyplot as plt

test= str(93283274658402812765)
test = [int(d) for d in test]
plt.axis([0, number, 0, 10])
plt.hist(test)
plt.show()

You may also want to change the axis line as

plt.axis([min(test), max(test), 0, 10])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM