Reputation: 13051
I am trying to plot the frequency of integers in a large list of number in a large range. More specifically:
ints = np.random.random_integers(0,1440,15000)
ints
is a long list of integers with values between 0 and 1440. Next I want to plot a histogram that will visualize the frequencies. To that end, I use something like:
fig_per_hour = plt.figure()
per_hour = fig_per_hour.add_subplot(111)
counts, bins, patches = per_hour.hist(
ints, bins = np.arange(0,1441), normed = False, color = 'g',linewidth=0)
plt.show()
But I face two problems:
For reference, here's the output I have so far:
Upvotes: 0
Views: 9220
Reputation: 17877
I'd use set_xlim
and a smaller number of bins, e.g. bins = 100
:
from matplotlib import pyplot as plt
import numpy as np
ints = np.random.random_integers(0,1440,15000)
fig_per_hour = plt.figure()
per_hour = fig_per_hour.add_subplot(111)
counts, bins, patches = per_hour.hist(
ints, bins = 100, normed = False, color = 'g',linewidth=0)
plt.gca().set_xlim(ints.min(), ints.max())
plt.show()
Edit: You can manually resized window:
In principal you can do this programmatically with plt.figure(figsize=(20, 2))
. But somehow the window size is limited to the screen size.
Upvotes: 3